Join Two Text Files

added on October 2, 2006 by Marjo Martinez
Applies To: AutoMate 6, AutoMate 5

This task will join two text files using two variables, one for each text file, two Read from file actions and a Write to file action.

First the variables are created named myvar and myvar2. When each Read from file action is defined, one of the variable names is used in the 'Populate variable with read data' field. A Write to file action is used to join the two variables containing file data creating one file.

Note: In order for the task to work properly, please create a folder named Temp in your C:\ drive and create files named test1.txt and test2.txt (with some data) in your temp folder or modify both Read From File actions to point to a valid text file which includes data.

Download This Task (0.8kb) Join_text_files.aml
Would you like to upload a Sample Task or Workflow to the User Resource Center? Click here!

More Sample Tasks and Workflows

Workflow Loop Sample (workflow) 8/22/16Leonard Amabile

This sample demonstrates how a workflow loops through a shared dataset using the evaluation object and NO loops within the tasks.

Inline Padding Sample (task) 8/22/16Leonard Amabile

This sample demonstrates how to pad a string inline with leading or trailing spaces.

Updating SharePoint list issue 5/10/16Erez Ronen

Hi, I'm tring to update SharePoint list anf got the following error : Error message: SharePoint failed (Error : The underlying connection was closed: An unexpected error occurred on a receive.) The automate version is (Premium + runtime) The failure step : <AMSHAREPOINT ACTIVITY="get_listitems" AM_RETRY="3" AM_RETRYDELAY="500" LIST="Agile_DMO_SAP" QUERY="<View><RowLimit>2</RowLimit></View>" RESULTDATASET="DSGetList" SITE="" /> Please advise

Trigger, actually: 7 to 7 11/17/15Matt Tollerson

I need to create (a) trigger(s) to execute my task at different frequencies depending-upon the time of day. I want my task to trigger every 15 minutes from 7a.m. till 7p.m. and then only trigger every hour from 7p.m. till 7a.m. I also want it to not trigger on Saturday nor Sunday. From what I can tell: exceptions let me do that but then stop triggering alltogether. Please write me back if you have an idea. Thanks in advance, Matt T.

Split filename into two variables 5/15/15Valentineo McGowan

A task has a name of 'abc_123.txt' I would like the folder name to be the prefix of the filename prior to the "_" delimiter 'C:\abc'. File 123.txt will then be placed inside C:\abc\123.txt

Count Rows in TXT/CSV using Regular Expression 5/15/15Valentineo McGowan

I have a *.txt or *.csv containing column headers and X rows of data. Using RegEx the task simply counts the number of rows based on carriage returns. Great for csv files that have X amount of records and you simply need a total count of rows minus the headers.

Dataset to CSV File using Excel action 5/15/15Valentineo McGowan

How do I create a CSV file from a dataset without using Interactivity actions inside MS Excel, ie, 'File Save As.'? Here's how to create a CSV file in one step using a dataset with our 'Excel - Set cells' activity.

Dataset to CSV using ODS action 5/15/15Valentineo McGowan

How do I create a CSV file from a dataset without Microsoft Excel being present on my machine? Here's how to create a CSV file in one step using a dataset with our new 'ODS (OpenDocument Spreadsheet) - Set cells' activity.

Hide window 4/18/15Ali Zamani

Using this task, you can hide the windows that are active in the field of view. Posted by Younes Raeisi

Text Spinner/Randomizer aka Article Spinner 3/19/15Timur Khasanov

This task can be successfully applied in any area, be it SEO article writing, to make your content look as unique as possible every time you submit it, email marketing campaigns, to personalize your messages and adding authenticity in every message you send out, actually anything you can think of in Internet Marketing world and beyond! Input (at Step 11): put the words you want to randomly be chosen in brackets "{}", separated by "|" sign and that's it! Script automatically compiles a unique content every time you run it! Output is passed onto a variable and be used in further infrastructure. See for yourself.


Comments (4)

  1. 5/3/07 by Amy Mash
    Thanks to this example I no longer have to manually combine 2 text files that are created on a daily basis in to 1 file. And with the help in Module 3-creating a variable with a date format, I was able to allow for the current date to be read from the 2 files and include it in the new file.
    &lt;AMVARIABLE NAME=&quot;yyyymmdd&quot;&gt;&lt;/AMVARIABLE&gt;<br /> &lt;AMTEXTFORMATDATETIME DATETIMEFORMAT=&quot;yyyymmdd&quot; 12HOURFORMAT=&quot;NO&quot; RESULTVARIABLE=&quot;yyyymmdd&quot;&gt;<br /> &lt;!--- variable myvar1 to hold textfile1%yyyymmdd%.txt file ---&gt;<br /> &lt;AMVARIABLE NAME=&quot;myvar1&quot; DESCRIPTION=&quot;myvariable1textfile1&quot;&gt;&lt;/AMVARIABLE&gt;<br /> &lt;!--- variable myvar2 to hold textfile2%yyyymmdd%.txt file<br /> ---&gt;<br /> &lt;AMVARIABLE NAME=&quot;myvar2&quot; DESCRIPTION=&quot;myvariable2textfile2&quot;&gt;&lt;/AMVARIABLE&gt;<br /> &lt;!--- Read data from textfile1yyyymmdd.txt file ---&gt;<br /> &lt;AMFILEREAD FILE=&quot;\\svr\path\folder\textfile1%yyyymmdd%.TXT&quot; RESULTVARIABLE=&quot;myvar1&quot;&gt;<br /> &lt;!--- Read data from textfile2%yyyymmdd%.txt file<br /> ---&gt;<br /> &lt;AMFILEREAD FILE=&quot;\\svr\path\folder\textfile2%yyyymmdd%.TXT&quot; RESULTVARIABLE=&quot;myvar2&quot;&gt;<br /> &lt;!--- Join the data, appending textfile2%yyyymmdd%.TXT file&apos;s data after writing the textfile1%yyyymmdd%.TXT file&apos;s data ---&gt;<br /> &lt;AMFILEWRITE FILE=&quot;\\svr\path\folder\newfile%yyyymmdd%.TXT&quot;&gt;%myvar1 + myvar2%&lt;/AMFILEWRITE&gt;
  2. 4/8/09 by Chris Jones
    Does anyone know how to add an additional blank line after the last line of data in the text file?
  3. 4/27/09 by Leonard Amabile
    Hi Chris, Using the Write to File action specifying %""% in the data field will add a blank line to the end of the file as long as you have the "append at the end of the file" option selected.
    &lt;AMFILEWRITE FILE=&quot;C:\test.txt&quot;&gt;%&amp;quot;&amp;quot;%&lt;/AMFILEWRITE&gt;
  4. 1/24/11 by Laurie Beffa
    Is there a way to remove the blank row between the merged files?
Please sign in to your account or your comment will be forever stored under "anonymous".
Include Code Snippet

Search the URC

Subscribe to Version History via RSS
Subscribe to Version History via RSS
Version Watcher

10.7.0 changelog
10.7.0 changelog
other versions downloads


Subscribe to Latest Resources via RSS
Subscribe to Latest Resources via RSS
Latest Resources

show filter options

Subscribe to Forum Posts via RSS
Subscribe to Forum Posts via RSS
Forum Posts