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

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

821


Explain command to display different lines that are found when compare two files?

676


Which command is used to restrict incoming messages?

592


Write a command that will find all text files in a directory such that it does not contain the word "amazing" in any form (that is, it must include the words amazing, amazing, or amazing)?

954


why metadb requires a seperate slice to create Solaris volume manager

2554






What does this command do,"$more readme.txt“?

688


What does the md command do?

568


What does awk stand for?

606


Enlist some filename manipulation commands in unix.

549


What is the use of tee command?

567


Why is awk called awk?

577


Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?

589


What do know about tee command and its usage?

586


How do I search for text in vi?

584


Who wrote grep?

579