What is the syntax of "grep" command?
Answers were Sorted based on User's Feedback
syntax of "grep" command
syntax: grep {word to lookup} {filename}
Ex: grep man test
Is This Answer Correct ? | 29 Yes | 6 No |
Answer / 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 |
Answer / vasanth
grep: Find lines in a file that match a regular expression
syntax: grep [options] pattern [files]
Useful Options : -v, -l, -L, -c, -n, -b, ,-i
-v Print only lines that donot match the regular expression
-l Print only names of files that contains matching
lines,not the line themseleves
for furthur information
pls ref. linux pocket guide by Daniel J. Barrett (page-71)
Is This Answer Correct ? | 14 Yes | 4 No |
Answer / 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 |
if i have 2 files file1 and file2.... file1 contains 2 columns like b a 11 aa 12 as 13 ad 15 ag 11 ar 13 ah 15 ak file2 contains b c 10 ds 11 at 15 gh 15 jk 13 iu 11 fg 13 yy can any 1 give me the program to display in this way? a b c aa 11 at ar 11 fg ad 13 iu ah 13 yy ag 15 gh ak 15 jk
How to customise the existing shell?
What happens on a system call?
What is the best shell scripting language?
What is use of "cut" command?
Explain about shebang?
What is the command for " how many shell is running in your system or how many shell supported by your system " ?.
Write a shell script to check whether a number is Armstrong number or not?
What are environment variables?
Create a bash shell script that reads in a number from the user. If the number is 1, print out the date. If the number is 2, list the files in the current directory. If the number is 3, print out who is currently logged onto the system. If the number is anything else, print out an error message and exit. Name this script "various.sh"
Is shell a scripting language?
Write a shell program to test whether a given number is even or odd?