linux - sed changes are lost (while running cat command on txt file) -


i need insert command "new file" in test.txt file @ line number 4.

tried sed; can see changed file output, when again cat test.txt, changes gone.

sed "4i new file" /test.txt 

how can save changes?

sed '4i new file' test.txt > tmp && mv tmp test.txt


Comments