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 / sona shaw
grep, egrep, fgrep - print lines matching a pattern
SYNOPSIS
grep [options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
e.g
grep "24:02:2010" date.txt
o/p is :hi today is 24:02:2010
here we should keep the matching patten in double
qoute"xxxxxxxx" and date.txt is inputfile in which u have
to search the pattern. for more details see manual page of
grep.type man grep and see various option
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
What are the unix commands?
What is nr in awk command?
What is awk used for?
What is grep short for?
Write a command that will find all text files in a directory such that it does not contain the word "amazing" in any form (that is, it must include the words amazing, amazing, or amazing)?
How do I search for a file in unix command?
How many unix commands are there?
What does grep v do?
What is the unix command to confirm a remote host is alive or not?
What do chown command do?
What is the behavioural difference between cmp and diff commands?
How does the system know where one command ends and another begins?
Explain mount and unmount command.
Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?
When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system.
How can i findthe right soluion???
My pgm:
#include