Grep command to fetch all the content only specified text

Here is the grep command to fetch all the content except the specified.

Syntax: cat <SRC File Name>| grep “<search string>”  >  <DEST File Name>

Ex: cat test.txt | grep  -v “string t o find” > test1.txt

This command will filters those lines which contains the specified text. Remaining will be copied to the output file.

Related Post :

http://blog.theunical.com/linux/grep-command-to-fetch-all-the-content-except-specified-text/

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image