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 / mo

#1: grep '[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'
<filename> | more

from #1 output see which column is returned for date.

use next this command.

#1: grep '[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'
<filename> | cut -f<from the first command> -d"<Delimeter
of file>

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you grep a case insensitive?

1053


What is ‘ps’ command for?

1188


What do chmod, chown, chgrp commands do?

1294


What is grep command in unix with examples?

1225


What do chgrp command do?

1224


Write a command that will display files in the current directory, in a colored, long format.

1233


Who command in unix?

1148


Why is shebang used?

1133


Which unix command lists files/folders in alphabetical order?

1765


Is it inbetween or in between?

1066


Name the unix command to find how many days the server has been up.

1167


Can you explain a little bit about command substitution?

1118


What is unix command line?

1265


What is the difference between awk and grep?

1260


What is command statement?

1184