Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
Goeduhub's Online Courses @ Udemy in Just INR 570/-
Online Training - Youtube Live Class Link
0 like 0 dislike
in KU B.Tech (CSE-VII Sem) Unix & Linux Programming Lab by Goeduhub's Expert (7.6k points)
recategorized by
implementation using fgrep commands

Goeduhub's Top Online Courses @Udemy

For Indian Students- INR 360/- || For International Students- $9.99/-


Course Name



Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon


Natural Language Processing-NLP with Deep Learning in Python Apply Coupon


Computer Vision OpenCV Python | YOLO| Deep Learning in Colab Apply Coupon
    More Courses

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.6k points)
edited by
Best answer

implementation using fgrep commands

The fgrep filter is used to search for the fixed-character strings in a file. There can be multiple files also to be searched. This command is useful when you need to search for strings which contain lots of regular expression metacharacters, such as “^”, “$”, etc.

Syntax: fgrep [options] [ -e pattern_list] [pattern] [file]

Options and Descriptions  

-cIt is used to print only a count of the lines which contain the pattern.
-hUsed to display the matched lines.
-iDuring comparisions, it will ignore upper/lower case distinction.
-lUsed to print the names of files with matching lines once, separated by new-lines. It will not repeat the names of files when the pattern is found more than once.
-nIt is used precede each line by its line number in the file (first line is 1).
-sIt will only display the error messages.
-vPrint all lines except those contain the pattern.
-xPrint only lines matched entirely.
-e pattern_listSearch for a string in pattern-list (useful when the string begins with a “-“).
-f pattern-fileTake the list of patterns from pattern-file.
patternSpecify a pattern to be used during the search for input.
fileA path name of a file to be searched for the patterns. If no file operands are specified, the standard input will be used.

Example of -c 

Example of -h

Example of -i and -l

Example of -n

Example of -v

Example of -l

Example of -i

For more Kurukshetra University(KU) B.Tech (CSE-VII Sem) Unix & Linux Programming Lab Experiments Click Here

3.3k questions

7.1k answers


4.6k users

Related questions


About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © Social::   |  |