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 a file called test.txt, how do you replace all occurences of "GNU" in that file with "NGU", you can have this output just go to prompt/stdout (no need to capture it in new file).
Answer
sed -e 's/GNU/NGU/g' test.txt
^^ note you have to use the -e flag (e for expression), and you have to use the last /g in the find/replace clause to indicate replace all instances of GNU not just the first one.

Question
In linux, you have a file called test.txt, how do you replace all occurences of "GNU" in that file with "NGU", you can have this output just go to prompt/stdout (no need to capture it in new file).
Answer
?

Question
In linux, you have a file called test.txt, how do you replace all occurences of "GNU" in that file with "NGU", you can have this output just go to prompt/stdout (no need to capture it in new file).
Answer
sed -e 's/GNU/NGU/g' test.txt
^^ note you have to use the -e flag (e for expression), and you have to use the last /g in the find/replace clause to indicate replace all instances of GNU not just the first one.
If you want to change selection, open document below and click on "Move attachment"

8. Streams and sed -- The Stream Editor
rence in the same line (usually sed just replaces the first occurrence of the regular expression in each line). (There are other <option> ; see the sed info page.) For demonstration, type <span>sed -e 's/e/E/g' and type out a few lines of English text. 8.7 Regular Expression Subexpressions The section explains how to do the apparently complex task of moving text around within lines. Consider,

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.