I am using these two sed expressions piped together
sed -e "1 i\MODEL" file.txt | sed -e 's/END/ENDMDL/g' > output.txt
to 1) add "MODEL" on the first line of text.txt and then to substitute END with the ENDMDL within the same file.
How it would be possible make the both actions by means of one SED command (thus avoiding pipe) not producing a new file but rather to substitute existing one ? Finally I would like to know how it would be possible to add something on the last line of the file?