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:
-a
Don't suppress output lines with binary data, treat as text.
-b
Print the byte offset of input file before each line of output.
-c
Print's the count of line matched.
-h
Print matched lines but not filenames.
-i
Ignore changes in case; consider upper- and lower-case letters equivalent.
-n
Print line and line number.
-q
Prints in quite mode, prints nothing.
-r
Recursively read all files in directories and in subdirectories found.
-v
Prints all the lines that do not match.
-V
Print Version.
-w
Match on whole word only.
EXAMPLE:
Lets assume that we have a file file1.txt and it has the following data.
hscripts is the parent site of www.forums.hscripts.com
ask your technical doubts in our forum
our forums is free
To search and print the lines containing forum :
fgrep 'forum' file1.txt
fgrep command prints the output as.
hscripts is the parent site of www.forums.hscripts.com
our forums is free
Find LINUX Commands... Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this LINUX / UNIX cmd reference. This is a copyright content.