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 is unix command?
How do I find previous commands in unix?
How does pipe () work?
Why is it called grep?
What command will change your prompt to myprompt?
Name the various commands that are used for the user information in unix.
Explain mount and unmount command.
What are reported commands?
What is awk used for?
What are the dos commands?
What is the command to find hidden files in the current directory?
What is the command to compare two files in unix?
What does #!/ Bin sh do?
Who command in unix operating system?
What is grep command in unix with examples?