Shell Scripting – Grep

Grep searches the named input FILEs (or standard input if no files are named, or the file name is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.

More info can be seen at http://www.tutorialspoint.com/unix_commands/grep.htm

Eg : grep “STRING %pathtofile% | cut -d -f2

        Search for a string in a file  , the “pipe” connects the stdout of one command to the stdin of another , cut with dlimiter ” and select the second term (-f2)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s