For the life of me, I cannot find out how to do this very simple procedure. I want to:
- read a file, which consists only of number on each line
- append characters before and after the number in the file.
For example, in the contents of the file:
1
2
3
would turn into:
file1.txt
file2.txt
file3.txt
I've tried this:
sed 's/[0-9]+/{file&.txt}/' file_name.txt
but nothing happened. I see snippets online that say use {0} or {/1} but I am having a hard time finding an explanation of what this means.
The end goal of this is to have xargs copy all the filenames in this text to another directory. I am sure there is probably another way to accomplish this without the text file I am doing here. If anyone has a simpler answer to that end goal, that would be nice to hear, although I also want to figure out how to use sed! Thanks.