home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: false Chapter 2
UNIX Commands
Next: Reference: file
 

fgrep



fgrep

 [

options

] [

pattern

] [

files

]

Search one or more files for lines that match a literal, text-string pattern . Because fgrep does not support regular expressions, it is faster than grep (hence fgrep , for fast grep ). Exit status is 0 if any lines match, 1 if not, and 2 for errors. See also egrep and grep .

Options

-b

Precede each line with its block number.

-c

Print only a count of matched lines.

-e pat

Use this if pattern pat begins with - .

-f file

Take a list of patterns from file .

-h

Print matched lines but not filenames (inverse of -l ).

-i

Ignore uppercase and lowercase distinctions.

-l

List filenames but not matched lines.

-n

Print lines and their line numbers.

-s

Silent mode: print only error messages, and return the exit status.

-v

Print all lines that don't match pattern .

-x

Print lines only if pattern matches the entire line.

Examples

Print lines in file that don't contain any spaces:



fgrep -v ' ' 



file

Print lines in file that contain the words in spell_list :



fgrep -f spell_list 



file


Previous: Reference: false UNIX in a Nutshell: System V Edition Next: Reference: file
Reference: false Book Index Reference: file

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru