let’s say I have a folder with a thousand files named File1.csv, File2.csv, …, File1000.csv and every one contains some lines of semicolon-separated (;) data values.
I need a Perl script to “merge” all the csv files in that folder into one by appending each file one after another and also adding another data column at the end of each line with name of the file being currently processed (without the ending, e.g. “;File2”).
Steve
Text::CSVcan be used to parse CSV. The following script is to be run from within the directory containing the CSV files. It is not recursive (aglobhas been used). If you require it to recursively find files, you can use theFile::FindPerl module.