Issue
file xz.txt
123
456
789
I want to merge
sed -i '1d' xz.txt
sed -i '1a abc' xz.txt
I tried
sed -i -e '1d' -e '1a abc' xz.txt
expect to get
456
abc
789
but I got
456
789
sed (GNU sed) 4.7 but it doesn't work, any help?
Solution
Sed goes line by line, first command 1d
- deleted 1st line, 1st line is gone, there is no more 1st line, that is why second command 1a abc
didn't work. Here is how it should be:
$ sed '1d; 2a abc' f
456
abc
789
Answered By - Ivan Answer Checked By - Senaida (WPSolving Volunteer)