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
Explain how to use grep command to list find the records of a file containing 10 different strings?
Write a command that will allow a unix system to shut down in 15 minutes, after which it will perform a reboot.
What happens when we execute a unix command?
How many unix commands are there?
What do know about tee command and its usage?
What is difference between grep and find command in unix?
What is s and g in sed command?
How to use grep command to list find the records of a file containing 10 different strings?
Name the various commands that are used for the user information in unix.
What is the pipe command?
What is the general format of unix command syntax?
How do I use nslookup?
What is grep r?
Describe the usage and functionality of the command rm –r * in unix?
What do know about tee command?