Hi Guys,
I'm having a hard time bringing out my desired output from my korn shell script. This particular statement from my script its seems not working perl -ne 'print if $_ lt ${date1}' . My complete script as shown below. Please help.
Code:
#!/usr/bin/ksh
HOME=/export/home/REPORTS/Stats
BIN=${HOME}/bin
OUT=${HOME}/out
date1=`date '+20%y-%m-%d'`
hostname=`hostname`
work1=`cat file.txt | grep -i ' 2 1' | nawk '{print $4}' | perl -ne 'print if $_ lt ${date1}' > ${OUT}/report.txt`
input file:
file.txt
Jason 2 1 2009-11-21
Richard 7 1 2011-03-29
Mark 2 1 2010-10-02
Michael 14 1 2010-08-23
Nora 15 1 2010-06-23
Beth 2 1 2008-02-06
Nick 2 1 2010-12-09
Danny 2 1 2010-10-27
Dexter 30 1 2010-05-07
Garry 2 1 2011-06-14
Allan 2 1 2010-02-26
Ben 39 1 2010-03-15
Now I'm expecting output like this below.
output file:
report.txt
2009-11-21
2010-10-02
2008-02-06
2010-02-26
Thanks in advance.
Br,
victorneri