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
149 views
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/-

S.No.

Course Name

 Coupon

1.

Tensorflow 2 & Keras:Deep Learning & Artificial Intelligence

Apply Coupon

2.

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

3.

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  

Options Descriptions
-c It is used to print only a count of the lines which contain the pattern.
-h Used to display the matched lines.
-i During comparisions, it will ignore upper/lower case distinction.
-l Used 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.
-n It is used precede each line by its line number in the file (first line is 1).
-s It will only display the error messages.
-v Print all lines except those contain the pattern.
-x Print only lines matched entirely.
-e pattern_list Search for a string in pattern-list (useful when the string begins with a “-“).
-f pattern-file Take the list of patterns from pattern-file.
pattern Specify a pattern to be used during the search for input.
file A 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

394 comments

4.6k users

Related questions

 Goeduhub:

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