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 how to use grep command to list find the records of a file containing 10 different strings?

593


Write a command that will allow a unix system to shut down in 15 minutes, after which it will perform a reboot.

620


What happens when we execute a unix command?

597


How many unix commands are there?

626


What do know about tee command and its usage?

586






What is difference between grep and find command in unix?

577


What is s and g in sed command?

557


How to use grep command to list find the records of a file containing 10 different strings?

643


Name the various commands that are used for the user information in unix.

539


What is the pipe command?

574


What is the general format of unix command syntax?

691


How do I use nslookup?

573


What is grep r?

591


Describe the usage and functionality of the command rm –r * in unix?

820


What do know about tee command?

601