awk 小于或等于不起作用

awk less than or equal does't work

tmp.log :

[2016-12-01 00:00:01] ... 
[2016-12-01 00:00:02] .... 
[2016-12-01 00:00:03] ..... 
[2016-12-01 00:00:04] ......

命令:

awk '[=11=]>="[2016-12-01 00:00:01]" && [=11=]<="[2016-12-01 00:00:03]"' tmp.log

输出:

[2016-12-01 00:00:01] ...
[2016-12-01 00:00:02] ....

预计:

[2016-12-01 00:00:01] ...
[2016-12-01 00:00:02] ....
[2016-12-01 00:00:03] .....

为什么“<=”不起作用?

因为$0是你的整条记录,第三行是“[2016-12-01 00:00:03] .....”,比“[2016-12-01 00:00:03]".