I have lots of CSV files and I need the filename of each specific CSV file in every line of each file.
Original file content of abc123.csv
:
ColVal_1;ColVal_2;ColVal_3
ColVal_4;ColVal_5;ColVal_6
New file content:
ColVal_1;ColVal_3;ColVal_3;abc123.csv
ColVal_4;ColVal_5;ColVal_6;abc123.csv
All CSV files are in the same directory. I don't want to specify the name of each file.
Best Answer
Its much more simple, easier and faster with
sed
andxargs
. Heresed
uses in-place editing thus avoiding additional shell tools.And here is the output.