Is there a way with aw to print all lines after a string is found
There is a file like this
.......
........
2012/19/11 :11.58 PM some data
lne no date
2012/19/11 :11.59 PM some other data
2012/20/11 :12.00 AM some other data
some line without dates
some more lines without dates
2012/20/11 :12.01 AM some more data
....
.......
I need a way to display all lines after the first occurrence of the string 2012/20/11
That is
2012/20/11 :12.00 AM some other data
some line without dates
some more lines without dates
2012/20/11 :12.01 AM some more data
....
.......
dt="11/20/12"
echo $dt
11/20/12
new_dt=`echo $dt | awk -F'/' '{ print "20"$3"/"$2"/"$1 }' | sed 's#\/#\\\/#g'`
echo $new_dt
2012\/20\/11
nawk '/'"$new_dt"'/,EOF { print $0 }' datefiltertestfile.txt
2012/20/11 :12.00 AM some other data
some line without dates
some more lines without dates
2012/20/11 :12.01 AM some more data
....
.......
Not a single match attempt in an OP post has actually used or required a pattern. They've all been literal matches. If that's always going to be the case, I would recommend using a simpler, less error-prone literal match in favor of regular expression pattern matching.
If the date is the first text on a line and is followed by whitespace, as is the case in the samples:
awk '$1==x,0' x=11/20/12
For a more general solution which matches the string at any location in a line: