Quote:
Originally Posted by Rotwang
Ok almost perfect. The message I want to insert is actually multiple lines- can I stick the text from another file on line 2 rather than input from the quotes there?
|
Yes. To insert the content of another file use the command
r. Suppose you have the text to insert in a file named insert.txt
Code:
sed -i '1r insert.txt' file1 file2 file3
This will insert the content of insert.txt after the first line in file1, file2 and file3.
Quote:
Originally Posted by Rotwang
I also don't want the backup, but I think I can figure out how to remove that by piping find "*.bck" and piping that to rm -f or something.
|
Nope. Just remove the .bck from the -i option, as in my example above
Code:
sed -i blah blah blah
will edit files in place without doing the backup. Dangerous if you don't test the command before actually editing your original files!