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 / mo
#1: grep '[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'
<filename> | more
from #1 output see which column is returned for date.
use next this command.
#1: grep '[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]'
<filename> | cut -f<from the first command> -d"<Delimeter
of file>
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How do I open a port?
Explain ‘library functions’ with respect to unix commands?
How does shebang work?
Describe the usage and functionality of the command rm –r * in unix?
Which command is used to copy files?
What does this command do,"$more readme.txt“?
What does 'mkdir' command do in UNIX?
hw will u use awk in replacing cahrs and files
Which command will print your home directory on screen?
What do chgrp command do?
Name the general commands in using unix os for a beginner?
how to sort the content of the file based on numeric values
Who command in unix operating system?
What is the use of the tee command?
What is grep in bash?