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 command to show the space allocation of files?
What does the command ' $who | sort –logfile > newfile' do?
Write a command to display a file’s contents in various formats?
How does shebang work?
Differentiate cat command from more command.
Explain the steps that a shell follows while processing a command.
What is grep in bash?
Which command can you use to find the currently running process in unix server?
What is the use of awk command in unix?
How to display no of records in oracle using unix command?
Which unix command to make a new directory?
What is the command to view process running?
Which command should you use to find the remaining disk space in unix server?
Give the command for finding the current date.
What is the pipe command?