Hello All
Please I have got a file called DATE.tex which consist of
01-04-2008_12:00:00
01-04-2005_12:00:00
01-04-2003_12:00:00
01-04-2007_12:00:00
01-04-2002_12:00:00
01-04-2009_12:00:00
I want to use nawk to print out the dates >=01-04-2009_12:00:00
I tried this
cat plnt.new | nawk '{if($1>="01-04-2009_12:00:00"){print}}'
But it seems not doing the job. I want to use nawk to do this filtering.
Can any one help?
code:-
sed 's/_/-/' input.txt | nawk -F"-" '($1 >= '01') && ( $2 >= '04') && ( $3 >= '2009')'
There is a small problem here. if date is 01 March 2010 then
$2 >='04 will fail.
I suggest using datecalc, written by one of administrators.
kindly see input file!!!
there is no month written in word ..only digits.
Input....
01-04-2008_12:00:00
01-04-2005_12:00:00
01-04-2003_12:00:00
01-04-2007_12:00:00
01-04-2002_12:00:00
01-04-2009_12:00:00
convert date/time to YYYYMMDDhhmmss format and do the numeric comparison.
For clarity I chose Mar
I meant 03>04 wil fail.
NO IT WILL NOT Fail I had Tried IT.
uname -a
SunOS server8 5.10 Generic_118833-36 sun4u sparc SUNW,Sun-Blade-100