What is the syntax of "grep" command?

Answer Posted / kaustubh

grep command is a utility which helps in searching pattern
from the given file.

example

grep "pattern" /home/username/somefile.txt

it ll search all lines in the file somefile.txt and will
print the line which contains pattern.

there are many options as
-v = invert
-i = ignorecase
-c = count
-l = filename
-r = recursive

Is This Answer Correct ?    7 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the syntax of "nested if statement" in shell scripting?

702


Explain about shebang?

688


Explain about debugging?

678


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

716


What is the meaning of $1 in shell script?

696






How do we delete all blank lines in a file?

667


is this growing field and what is average package in this?

1957


What are the four fundamental components of every file system on linux?

1266


How to write a function?

676


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

621


Why do we use shell scripting?

615


What is meant by $1 in shell script?

628


Where is bash history?

586


Why should we use shell scripts?

695


How to get the last line from a file using just the terminal?

758