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 just print out the lines from test.txt that have both the words 'GNU' AND the word 'Test" (in any order)?
Answer
grep -w 'GNU' test.txt | grep -w 'Test'
^^ note the use of two greps in a pipe to do the AND filtering.

Question
In linux, you have file called test.txt, how do you just print out the lines from test.txt that have both the words 'GNU' AND the word 'Test" (in any order)?
Answer
?

Question
In linux, you have file called test.txt, how do you just print out the lines from test.txt that have both the words 'GNU' AND the word 'Test" (in any order)?
Answer
grep -w 'GNU' test.txt | grep -w 'Test'
^^ note the use of two greps in a pipe to do the AND filtering.
If you want to change selection, open document below and click on "Move attachment"

8. Streams and sed -- The Stream Editor
he second grep command scans that data for lines with the word Linux in them. grep is often used this way as a filter [Something that screens data.] and can be used multiple times, for example, <span>grep L myfile.txt | grep i | grep n | grep u | grep x The < character redirects the contents of a file in place of stdin. In other words, the contents of a file replace what would normally come from a keyboard. Try grep GNU < gnu_lin

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.