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 called test.txt, how do you insert line "hello kevin" before line 7 of this file (note: do it so that the output will just be sent to stdout, i.e. the file itself will not be changed)
Answer
sed -e '7i \
hello kevin' test.txt

^^ note: the syntax of using 7i, to insert BEFORE line 7
^^ also note the use of '\' to break the line up properly, although following is totally correct too: sed -e '7i hello kevin' test.txt


Question
In linux, you have file called test.txt, how do you insert line "hello kevin" before line 7 of this file (note: do it so that the output will just be sent to stdout, i.e. the file itself will not be changed)
Answer
?

Question
In linux, you have file called test.txt, how do you insert line "hello kevin" before line 7 of this file (note: do it so that the output will just be sent to stdout, i.e. the file itself will not be changed)
Answer
sed -e '7i \
hello kevin' test.txt

^^ note: the syntax of using 7i, to insert BEFORE line 7
^^ also note the use of '\' to break the line up properly, although following is totally correct too: sed -e '7i hello kevin' test.txt

If you want to change selection, open document below and click on "Move attachment"

8. Streams and sed -- The Stream Editor
expression, so that it becomes 0 + .... 8.8 Inserting and Deleting Lines sed can perform a few operations that make it easy to write scripts that edit configuration files for you. For instance, <span>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 sed -e

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.