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

Explain the terms ‘system calls’ and ‘library functions’ with respect to unix commands?

658


What is the difference between cat and more command?

640


Explain command to view process running?

631


Explain ‘system calls’ with respect to unix commands?

610


What are grep patterns?

591






How is the command '$cat file2 ' different from '$cat >file2 and >> redirection operators ?

771


What does the metacharacter mean?

625


When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system. How can i findthe right soluion??? My pgm: #include # include int main() { int pid; pid=fork(); if(pid < 0) {exit(-1);} else if(pid==0) { printf("Child Process is Sleeping ..."); sleep(10); printf("Orphan Child's Parent ID : %u ",getppid()); } else { printf("Parent Process Completed ... %u ",getpid()); exit(0); } return 0; } Output:

1775


Can you enlist some commonly used network commands?

610


What is the difference between grep and grep?

584


Which command will print your home directory on screen?

561


Which unix command lists files/folders in alphabetical order?

626


What is nr in awk command?

622


What is pipe command in unix?

692


What is unix command?

596