I want to add a line to my bash script (ubuntu 16) to add the filename to the end of every line in a file - that is every file in a folder and all files in all subfolders.
Filenames are alphanumeric with some special characters like -_.
For example:
Line in file filename_ghrut.txt
before:
blah blah blah
blahblah blahblah
Line in file filename_ghrut.txt
after:
blah blah blah filename_ghrut.txt
blahblah blahblah filename_ghrut.txt
I have searched around but most commands don't seem to work.
I want to run this on all files in all subfolders of a specific directory.
Big thanks.
I found this, but it doesn't quite work:
ls file{1..5}.txt|xargs -I% sed -i 's/$/;%/' %