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

Who command in unix operating system?

663


How to find $ai_serual resolved path by using unix

1029


What are bash commands?

597


Which command can you use to find the currently running process in unix server?

588


What are the differences among a system call, a library function, and a unix command?

567






What are the unix commands?

560


What is time_t?

588


What is unix command?

584


What does 'mkdir' command do in UNIX?

660


what is the advaantage of each user having its own copy of the shell?

2038


What is {} in find command?

584


hw will u use awk in replacing cahrs and files

2736


What will the following command do?

617


What does touch command do in unix?

731


What is command substitution?

627