I have a file with data:
/homes/XXXX/YYYYY/file1:20150324
/homes/XXXX/YYYYY/file2:20150327
/homes/XXXX/YYYYY/file3:20150320
/homes/XXXX/YYYYY/file3:20150327
/homes/XXXX/YYYYY/file4:20150328
First field is path, :
as a separator and second field is a date. What I want to do is to select only those lines with date lower then some value.
gawk -v var="$SOMEVALUE" '{FS = ":"; if($2<=var) print;}'
This is what I have. It works fine, prints lines with lower value than I want to, but it everytime prints also the first line, no matter the value. Could you give me some advice what to do? thanks
What about:
gawk -F: -v var="$SOMEVALUE" 'var>=$2'
The error is that you had to change the field separator after you read the first row.