In linux, you have file, test.txt, how do you delete 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,5D' test.txt
^^ note the use of the 3,5D syntax, capital D!
Question
In linux, you have file, test.txt, how do you delete 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 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,5D' test.txt
^^ note the use of the 3,5D syntax, capital D!
If you want to change selection, open document below and click on "Move attachment"
8. Streams and sed -- The Stream Editor ce, sed -e '7a\ an extra line.\ another one.\ one more.' a ppends three lines after line 7, whereas sed -e '7i\ an extra line.\ another one.\ one more.' i nserts three lines before line 7. Then <span>sed -e '3,5D' D eletes lines 3 through 5. In sed terminology, the numbers here are called addresses, which can also be regular expressions matches. To demonstrate: sed -e '/Dear Henry/,/Love Jane/D'
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised 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.