Linux Server and Workstation Configuration How To

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
grep PDF Print E-mail
Tuesday, 15 December 2009 19:20
AddThis Social Bookmark Button

Command grep

grep command provides search in one or more files, lines that match the regular expression (search patterns).

Syntax

grep [options] pattern files

Options

-N (where N-number) displays the N lines near the line containing the sample.
-c displays the number of lines that contain the search pattern.
-f file Read options from the specified file.
-i ignores case letters.
-l displays the names of files containing the sample.
-n display line numbers next to the lines containing the sample.
-q returns the status code, but nothing prints.
-v print lines not containing the sample.
-w compares only whole words.

Description

The command grep searches for a template in these files. Typically, the grep command used to search a specified sequence of characters in one or more text files.

 

Add comment


Security code
Refresh

Useful Links

Follow us on ...

  • Digg: hgevs
  • Facebook Page: 180986722511
  • Linked In Group: 2571120
  • Ning: linuxconfignet
  • Twitter: linuxconfignet

Friends

Thanks David Ayvazyan for provided useful information and discussions.
www.gnu.am (Armenian Translation)