Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

How do I use grep to find a file?

1110


What does the “echo” command do?

1150


What is the use of the tee command?

1093


Explain command to show the space allocation of files?

1118


What do chmod command do?

1215


What is the pipe command?

1185


What does the md command do?

1129


Explain the steps that a shell follows while processing a command.

1226


Which command can you use to find the currently running process in unix server?

1120


Explain command to view process running?

1123


How does pipe () work?

1088


Why is shebang used?

1121


What are file commands?

1227


What does the metacharacter mean?

1130


What is grep short for?

1045