What is the syntax of "grep" command?

Answer Posted / satchi

Grep is a filter used for pattern matching in shell script.

It searches for the patern if file name is give, or else it
will look for the input data using pipe(|)

Syntax:

1. Grep <patern to search> <Filename>
2. cat <filename> | grep <Patern to search.>

we can use -i option to ignore case sensitiveness.There are
so many options available.you have to explore that.

Is This Answer Correct ?    18 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we run shell script in windows?

794


Is powershell a bash?

758


wats the deinitions for shell utility and filter?

2075


Give some situations where typing error can destroy a program?

934


How to print all array elements and their respective indexes?

712


How to find all the files modified in less than 3 days and save the record in a text file?

839


What are script files?

733


What does $@ mean bash?

836


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?

831


What are the different types of variables used in shell script?

749


How do I run a .sh file?

793


I want to connect to a remote server and execute some commands, how can I achieve this?

792


What is the purpose of scripting?

743


What is another name for a bash shell script that you might see?

1218


What is the use of .sh file?

815