header

fgrep COMMAND

fgrep COMMAND:
fgrep command is used to search one or more files for lines that match the given string or word. fgrep is faster than grep search, but less flexible: it can only find fixed text, not regular expressions.

SYNTAX:
The Syntax is
fgrep [options] pattern [file]

OPTIONS:
-aDon't suppress output lines with binary data, treat as text.
-bPrint the byte offset of input file before each line of output.
-cPrint's the count of line matched.
-hPrint matched lines but not filenames.
-iIgnore changes in case; consider upper- and lower-case letters equivalent.
-nPrint line and line number.
-qPrints in quite mode, prints nothing.
-rRecursively read all files in directories and in subdirectories found.
-vPrints all the lines that do not match.
-VPrint Version.
-wMatch on whole word only.



EXAMPLE:
Lets assume that we have a file file1.txt and it has the following data.
ask your technical solution in our forum

  1. To search and print the lines containing forum :
    fgrep 'forum' file1.txt
    fgrep command prints the output as.
    ask your technical solution in our forum

No comments: