03-26-2009 03:17 AM
Hi everyone,
I have multiple text files (couple of hundred) in a folder. I want to combine the data of the files into one file. It should obviously start at the oldest file and sequentially read the files to latest modified and append all the data to a new txt file.
Below is typical comma seperated data of two consecutive files:
2009-02-17,23:17:04,00ff,ffff,ff1c,0093,0000,0100,0001,d3ae,0cce,0cd4,0cd4,00c2,000a,09e4,0609,0000,0000,17c7
2009-02-17,23:17:06,00ff,ffff,ff1c,0093,0000,0100,0001,d3af,0cd5,0cd7,0ccf,00c2,000e,09e6,0608,0003,0000,17c7
2009-02-17,23:17:09,00ff,ffff,ff1c,0093,0000,0100,0001,d3b0,0cd2,0cd1,0cd5,00bb,000a,09f1,0608,0000,0000,17c7
2009-02-17,23:17:11,00ff,ffff,ff1c,0093,0000,0100,0001,d3b1,0c21,0ccf,0cd3,00c2,000a,09e3,0608,0000,0000,17c7
2009-02-17,23:17:14,00ff,ffff,ff1c,0093,0000,0100,0001,d3b2,0cc9,0cd5,0cd7,00c4,0008,09e4,0608,0000,0002,17c8
2009-02-17,23:17:16,00ff,ffff,ff1c,0093,0000,0100,0001,d3b3,0cd2,0cd6,0cd7,00bf,000d,09eb,0608,0000,0000,17c8
2009-02-17,23:17:19,00ff,ffff,ff1c,0093,0000,0100,0001,d3b4,0cc9,0cd8,0cd2,00c2,0009,09ea,0608,0000,0000,17c8
2009-02-17,23:17:21,00ff,ffff,ff1c,0093,0000,0100,0001,d3b5,0cd2,0cd1,0cd1,00c2,0009,09e8,0608,0000,0001,17c8
2009-02-17,23:17:24,00ff,ffff,ff1c,0093,0000,0100,0001,d3b6,0cd3,0cd3,0cd3,00ca,000a,09eb,0608,0001,0001,17c9
2009-02-17,23:17:26,00ff,ffff,ff1c,0093,0000,0100,0001,d3b7,0ccd,0cd8,0cd4,00bc,0006,09e6,0608,0001,0003,17c8
2009-02-17,23:17:29,00ff,ffff,ff1c,0093,0000,0100,0001,d3b8,0cd2,0cd3,0cd3,00c6,000a,09e9,0608,0001,0001,17c9
2009-02-17,23:17:31,00ff,ffff,ff1c,0093,0000,0100,0001,d3b9,0ccf,0cd3,0cd4,00ba,000a,09e8,0608,0000,0000,17c8
2009-02-17,23:17:34,00ff,ffff,ff1c,0093,0000,0100,0001,d3ba,0c1b,0cd3,0cd4,00c0,0009,09e9,0607,0001,0000,17c8
2009-02-17,23:17:36,00ff,ffff,ff1c,0093,0000,0100,0001,d3bb,0cd3,0cd4,0cd3,00c2,000a,09e8,0607,0001,0003,17c9
2009-02-17,23:17:39,00ff,ffff,ff1c,0093,0000,0100,0001,d3bc,0cd4,0cd4,0cd2,00b5,000a,09e9,0607,0001,0002,17c9
2009-02-17,23:17:41,00ff,ffff,ff1c,0093,0000,0100,0001,d3bd,0cbd,0cd4,0cd7,00c2,0009,09e8,0607,0001,0001,17c9
The text files have no headers just the raw data as seen above.
Would really appreciate any help. Thank you in advance.
Regards
Dan
Solved! Go to Solution.
03-26-2009 03:54 AM
Hi Dan,
I dont know which version of LabVIEW u using,I attached the vi in the v 8.5. My vi sorts the file names in alphabetical order use get file info vi to sort it as u mentioned
03-26-2009 04:17 AM
Hi Baji,
Brilliant, thank you for the quick response! Works perfectly!
Regards
Dan
04-22-2009 11:32 PM
04-23-2009 02:22 PM
Here is the file saved for 8.2.
-Christina
04-23-2009 06:35 PM
04-26-2009 11:03 PM
The transpose option will be available in both(read & write spread sheet).It will not available for read and write file.U can reverse the spread string using Reverse string function available at programming>>String>>Aditional string functions>>Reverse string,so before writing the file reverse the string and write to the file.
U can only do traspose to an array,u cant do for spreadsheet string.
04-27-2009 12:01 PM
In order to do this with the text file read and write functions, you will have to convert the output string to an array, transpose the array, and then convert it back to a string. The conversions can be done using the Spreadsheet String to Array and Array to Spreadsheet String VIs.
-Christina
05-04-2009 09:53 PM
Hi There,
I am having similar problem. I have multiple files with three column and 1000 rows. I need to open multiple file like that, copy third column from each file and write all these column in single file. I am comparatively new with labview and i use 8.2 on my mac but i have access to windows version also if needed.
Thanks for the help
Yogesh
05-04-2009 10:38 PM