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
What is unix command line?
What are file commands?
What do chown command do?
How do you grep a case insensitive?
Write a command to display a file’s contents in various formats?
What is the search command in unix?
What is the difference between cat and more command?
Which unix command lists files/folders in alphabetical order?
What's a command word?
How do I use grep to find a file?
What is the comma to show the space allocation of files?
Explain how to use grep command to list find the records of a file containing 10 different strings?
What are the differences among a system call, a library function, and a unix command?
What is ctrl d?
What is the functionality of a top command?