What sed command would allow me to append one string to the end of every line, a different string to the start of the first line, and a different string to the end of the fifth line?
So far I have
sed 's/$/<br>/' $FILE1 >> $FILE1_GETS_APPENDED_TO_THIS_FILE
to append a html break statement to the end of each line in the file1. I need to add a header statement around the first 5 lines though. Therefore, the start of the first line needs to have <h3> appended to it and the end of the fifth line needs </h3> appened to it.
Thanks!
It’s that easy:
As you use
$to match the end of the line, use^to match the start of the line.Then, for each of your commands (such as
s), you can specify a line number (or range) where it should apply.