Question
In linux, you have file, test.txt, how do you delete all lines except lines 3 to 5 from this file (where the new output is sent only to stdout, i.e. the file itself is not changed)?
sed -e '3,5!D' test.txt
^^ Note the use of the 3,5!D syntax

Question
In linux, you have file, test.txt, how do you delete all lines except lines 3 to 5 from this file (where the new output is sent only to stdout, i.e. the file itself is not changed)?
?

Question
In linux, you have file, test.txt, how do you delete all lines except lines 3 to 5 from this file (where the new output is sent only to stdout, i.e. the file itself is not changed)?
sed -e '3,5!D' test.txt
^^ Note the use of the 3,5!D syntax
If you want to change selection, open document below and click on "Move attachment"

8. Streams and sed -- The Stream Editor
hat the $symbol indicates the last line: sed -e '$i\ The new second last line\ The new last line.' and finally, the negation symbol, ! , is used to match all lines not specified; for instance, <span>sed -e '7,11!D' deletes all lines except lines 7 through 11. Next: 9. Processes, Environment Variables Up: rute Previous: 7. Shell Scripting Contents <span>

Summary

status measured difficulty not learned 37% [default] 0

No repetitions