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 / venkat
grep -o -P '(([0-2][0-9]|3[01]):([0][1-9]|[1][012]):[12][09][0-9][0-9])'
use Perl regex to validate the limits of date and month.
Pitfall: it might miss 31st of feb
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is {} in find command?
How to use grep command to list find the records of a file containing 10 different strings?
What is the use of the command 'ls -x chapter[1-5]' ?
What is the use of tee command?
What does awk stand for?
What do chmod, chown, chgrp commands do?
What are the unix commands?
How does shebang work?
How many unix commands are there?
What does the md command do?
What is the size of time_t?
What are filter commands in unix?
How do I search for text in vi?
What is in grep command?
What does this command do,"$more readme.txt“?