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

What are the general commands in using unix os for a beginner?

681


What command is used to check the current users?

681


Name the unix command to find how many days the server has been up.

701


What do know about tee command and its usage?

703


What do chgrp command do?

701






Explain the steps that a shell follows while processing a command.

767


What is awk command used for?

694


Which command is used to kill the last background job?

886


How do I run a bash script?

671


What are the dos commands?

746


Is command prompt unix?

681


What is merge command in unix?

1016


What's a command word?

677


Differentiate cat command from more command.

664


What is the command to view process running?

674