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

What are bash commands?

819


What do chgrp command do?

857


What is the use of sed command in unix?

861


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

1054


What do chmod, chown, chgrp commands do?

923


What is the comma to display different lines that are found when compare two files?

822


What are file commands?

881


What command is used to switching between users in unix?

785


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

893


Is grep faster than awk?

757


How does pipe () work?

803


Which command is used to create a directory?

808


What is the difference between cat command and more command?

824


Which command is used to kill the last background job?

1041


What is ctrl d?

824