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
What is ctrl d?
Which unix command to make a new directory?
How do I use grep to search for a file?
What do chgrp command do?
What is command statement?
What is rmdir command?
What is s and g in sed command?
What is the use of the tee command?
What does #!/ Bin sh do?
Explain the terms ‘system calls’ and ‘library functions’ with respect to unix commands?
What is the use of awk command in unix?
Give the command for finding the current date.
Name the various commands that are used for the user information in unix.
Enlist some filename manipulation commands in unix.
What are the commands in UNIX to list the files in a Directory?