grep — Search a File for a Pattern


/usr/bin/grep [-bchilnsvw] limited-regular-expression [filename... ] 
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] 
  -e pattern-list [-f pattern-file] ... [file... ] 
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvwx] 
  [-e pattern-list -f pattern-file [file... ] 
/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] 
  [-bhinsvwx] pattern [file... ] 


The grep command searches files for a pattern in one or more files and prints all lines that contain that pattern. grep (which stands for global regular expression and print) uses a compact, nondeterministic algorithm.


Be careful using the characters $, *, [, ^, |, (, ), and \ in the pattern-list because they are also meaningful to the ...

Get Solaris™ 7 Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.