Hi All, Can you please let me know how to grep for a
particular pattern in unix. I want to print the dates from
the file exp.txt. the date pattern is DD:MM:YYYY, I just
want to print all the dates from the file exp.txt.
Answer Posted / sona shaw
grep, egrep, fgrep - print lines matching a pattern
SYNOPSIS
grep [options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
e.g
grep "24:02:2010" date.txt
o/p is :hi today is 24:02:2010
here we should keep the matching patten in double
qoute"xxxxxxxx" and date.txt is inputfile in which u have
to search the pattern. for more details see manual page of
grep.type man grep and see various option
Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Write a command to display a file’s contents in various formats?
Describe the usage and functionality of the command rm –r * in unix?
Which command will print your home directory on screen?
What is .sh file?
What does 'mkdir' command do in UNIX?
How to display no of records in oracle using unix command?
How can you see the command line history?
Explain ‘system calls’ with respect to unix commands?
What is grep in bash?
Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?
What is pipe command in unix?
What are awk commands?
What does this command do? Cat food 1 > kitty
What does this command do,"$more readme.txt“?
Differentiate cat command from more command.