Delete lines with lower/higher ISO date using awk and/or sed -
i've following file:
data;ora;testo log;ambiente;jobname;nomeapp;nomescript;parametri; 20130216;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20130427;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20131010;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20130217;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20130217;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20130217;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;; 20140217;17-02-2014;15:15:13;devi valorizzare la variabile ambiente con "bcoll" o "bprod" ;;
the first line date in iso format increasing in every line.
i want cut line older given date using 1 line of shell script grep or awk or sed.
be careful header description fields.
it's important compatible aix, linux, solaris, not sed -i.
i've command extract line first empy line.
awk -f ";" '$1 < 20140101 {print $1}' log.csv
piping | awk '!/$1/' log.csv
doesnt' work maybe because there's multiple lines.
it doesn't work piping sed:
sed '/$1/ d' < log.csv
but 1 doesn't work:
for in awk -f ";" '$1 < 20140101 {print $1}' log.csv; awk '!/$i/' log.csv; done
nr==1 true in awk
first line. rest, use comparison
awk -f\; 'nr==1 || $1 < 20140101 { print }'
Comments
Post a Comment