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


Please Help Members By Posting Answers For Below Questions

Are you in or at the office?

609


What is the search command in unix?

595


What is $0 bash?

641


how to sort the content of the file based on numeric values

1242


Is command prompt unix?

575






How do I use grep to find a file?

577


What does find command return in unix?

591


What is the use of find command in unix?

575


How do I open a port?

587


What difference between cmp and diff commands?

717


What is the use of awk command in unix?

573


What do chown command do?

528


What are the unix commands?

549


What are grep patterns?

573


What is the use of finger command?

593