Reputation: 11
I tried
awk '$6 ~ /^2017-04-01/,/^2017-04-11/' filename
and another way
awk '$6~/^2017-07-04/, $6~/^2017-07-10/' filename
But it displayed all month data. what changes should done to filter range dated files.
Upvotes: 0
Views: 58
Reputation: 67467
you can write it this way
awk '"2017-04-01" <= $6 && $6 <= "2017-04-11"' file
for regex you should implement the range as patterns
awk '$6~/^2017-04-(0[1-9]|1[01])/' file
however, I think the first alternative is cleaner, faster as well.
Upvotes: 1