I am working in a linux environment and I would like to get some help on bash scripting to cut down on simple repetition.
I have long list of file names(937 to be exact). In that file on one row there is only one file name there, therefore, total of 937 lines in the file.
I would like to add certain text before the file name and add numbers after the file name in order.
so I would like something like this in the text file.
aa.exe
bb.exe
cc.exe
to
asd aa.exe 1
asd bb.exe 2
asd cc.exe 3
any help will be greatly appreciated.
Just for kicks, here's an awk version:
awk '{print "foo", $0, NR}' files.lst
If files.lst
consists of:
a.txt
b.txt
c.txt
...then this will output:
foo a.txt 1
foo b.txt 2
foo c.txt 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With