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
What difference between cmp and diff commands?
Enumerate some of the most commonly used network commands in unix?
Is ‘du’ a command? If so, what is its use?
How to display no of records in oracle using unix command?
What do chgrp command do?
Explain the steps that a shell follows while processing a command.
What is the use of awk command in unix?
What is grep r?
What is the use of finger command?
Explain ‘library functions’ with respect to unix commands?
What does find command return in unix?
What are the unix commands?
Which unix command lists files/folders in alphabetical order?
What are the commands in UNIX to list the files in a Directory?
Is grep faster than awk?