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 will the following command do?
What is the difference between cat and more command?
What are awk commands?
What does find command return in unix?
What is the size of time_t?
What is the first character of the output in ls l command?
What is the general format of unix command syntax?
What is sed awk grep?
Explain mount and unmount command.
When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system.
How can i findthe right soluion???
My pgm:
#include
What is command statement?
What is difference between grep and find command in unix?
Can you enlist some commonly used network commands?
What are the dos commands?
Write a command that will allow a unix system to shut down in 15 minutes, after which it will perform a reboot.