what is the use of "grep" command?

Answer Posted / kiran sangeri

grep is one of many standard UNIX utilities. It searches
files for specified words or patterns. First clear the
screen, then type
% grep science science.txt
As you can see, grep has printed out each line containg the
word science.
Or has it ????
Try typing
% grep Science science.txt
The grep command is case sensitive; it distinguishes
between Science and science.
To ignore upper/lower case distinctions, use the -i option,
i.e. type
% grep -i science science.txt
To search for a phrase or pattern, you must enclose it in
single quotes (the apostrophe symbol). For example to
search for spinning top, type
% grep -i 'spinning top' science.txt
Some of the other options of grep are:
-v display those lines that do NOT match
-n precede each matching line with the line number
-c print only the total count of matched lines

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I clear my terminal history?

839


How do you grep a case insensitive?

775


How do I use grep to search for a file?

815


Explain ‘library functions’ with respect to unix commands?

868


Name the various commands that are used for the user information in unix.

831


What does touch command do in unix?

1028


What is used to type command?

793


What is a bash command?

885


What is the use of awk command in unix?

810


Does cp command overwrite files?

879


Give the command for finding the current date.

805


Explain command to view process running?

854


What command is used to switching between users in unix?

816


What is command substitution?

949


What is the use of cut command in unix?

1004