LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append the content of a range of text files according to their string name

I want to append the contents of a certain range of text files with string names.

For example there are total 1000 files in a folder naming ABC000 to ABC999. I want to select the files from ABC040 to ABC215 according to the name of the file, like the first 3 characters are same for all files, so something like "ABC%d%d%d" sort of selection.

 

What will be the tool for selecting this range according to their file name or if there is any other way by which I could do this??

 

I am attaching a vi of appending all the files of a folder.

0 Kudos
Message 1 of 5
(2,838 Views)

Use scan from string with the string format "ABC%d" as the format specifier - this will return the number from the file name which you can then use in-range / a case structure / comparisons to select whether or not it matches the range you want.

 

Something like this:

MatchFilenamePattern.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 5
(2,815 Views)

Thank you Sam.

And if I want to select some particular columns from the files separated by tab or space and append those columns only then what can I do.??

0 Kudos
Message 3 of 5
(2,761 Views)

Your description isn't that clear - can you post an example? You probably want to read in the file as an array (e.g. using string to spreadsheet array, read from spreadsheet file) and you can then use the index array function to pick the columns/rows/cells you want from the array.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 5
(2,748 Views)

I have attached a text file which has number of columns and I want to append only 3 columns naming "PRN" "MJD" and "REFSV" from each such type of file.

How can I select only these three columns and append their data in a new text file ignoring the starting 4 lines which are same in each file-

 

"DATA FORMAT VERSION = 02
REV DATE = 2014-09-08
REF = AXTIME
CKSUM = 90"

 

I hope I am clear this time.

0 Kudos
Message 5 of 5
(2,739 Views)