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

Above answers allow 09:2332:19811981 input also to display.
Following may use to avoid that issue
grep -o '[0-9][0-9]:[0-9][0-9]:[0-9][0-9][0-9][0-9]' infile.txt

Is This Answer Correct ?    44 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are you in or at the office?

868


What are reported commands?

852


Does cp command overwrite files?

874


Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?

1077


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

822


What is the search command in unix?

863


What is ctrl d?

841


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

890


What is the size of time_t?

936


What do know about tee command?

886


What is the use of cut command in unix?

1003


How do I use nslookup?

807


What do know about tee command and its usage?

892


What is “chmod” command?

810


Is command prompt unix?

834