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 ‘ps’ command for?
What is the search command in unix?
What is the use of the tee command?
How do I use nslookup?
Who command in unix?
Explain the terms ‘system calls’ and ‘library functions’ with respect to unix commands?
What's a command word?
What are the commands in UNIX to list the files in a Directory?
Why is shebang used?
What are bash commands?
How do I delete files from command prompt?
What is command substitution?
Who invented grep?
Explain command to view process running?
What is the command to view process running?