Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



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)?
Answer
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)?
Answer
?

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)?
Answer
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

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.