I'm attempting to select certain data from numerous csv files using linux, making a new file containing just the data I require for processing.
I have started by using grep and awk commands to select the rows and columns I require from a file.
I then wish to add a column which gives the filename as an entry for all rows.
Finally I want to repeat this for a number of files in a folder and append the results into one file. Is there a way of doing this?
Thank you in advance for any help.
awkparts working (if you'd rather use another scripting language that's fine) for one file, you can use the shellfor f in *.csv; do ... doneorfind ... | while read f; do ... donetechniques to do many files; redirect the script output to get your one file out.bashand probablyawkit far enough.