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

Explain command to show the space allocation of files?

1083


What does the command ' $who | sort –logfile > newfile' do?

1245


Write a command to display a file’s contents in various formats?

1164


How does shebang work?

1025


Differentiate cat command from more command.

1096


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

1182


What is grep in bash?

1022


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

1076


What is the use of awk command in unix?

1081


How to display no of records in oracle using unix command?

1125


Which unix command to make a new directory?

1074


What is the command to view process running?

1077


Which command should you use to find the remaining disk space in unix server?

1249


Give the command for finding the current date.

1048


What is the pipe command?

1133