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

You can use the below command:
grep -o '[[0-9]*:[0-9]*:[0-9]*' infile

where infile is the input file to grep command.

Is This Answer Correct ?    16 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

586


What does the md command do?

568


What is the command to find maximum memory taking process on the server?

670


What are the commands in UNIX to list the files in a Directory?

616


How do you grep recursively?

555






What is the use of tee command?

567


What does this command do? Cat food 1 > kitty

975


What is {} in find command?

584


What is the general format of unix command syntax?

691


What is the size of time_t?

645


What is awk used for?

616


What is the difference between grep and grep?

565


Does cp command overwrite files?

620


What does the “echo” command do?

624


How can we use grep command in unix?

613