- 论坛徽章:
- 0
|
只去除非工作时间没问题。- cat aaa | awk -F '[, ]' '$3>="07:00:00"&&$3<"19:00:00"' | more
- bjenet.traffic.hpm6509.TenGigabitEthernet1_2#dian_xin.in,2014-06-02 16:32:00,1234540792.0
- bjenet.traffic.hpm6509.TenGigabitEthernet1_2#dian_xin.in,2014-06-02 16:33:00,1236734487.0
- bjenet.traffic.hpm6509.TenGigabitEthernet1_2#dian_xin.in,2014-06-02 16:34:00,1386642974.0
- bjenet.traffic.hpm6509.TenGigabitEthernet1_2#dian_xin.in,2014-06-02 16:35:00,1187887437.0
- bjenet.traffic.hpm6509.TenGigabitEthernet1_2#dian_xin.in,2014-06-02 16:36:00,1234163411.0
复制代码 我是mac系统,date -d这个参数肯定是不对的,如下:- -d dst Set the kernel's value for daylight saving time. If dst is non-zero, future calls to gettimeofday(2) will return a non-zero for tz_dsttime.
复制代码 我试着去除非工作日,就报错了。如下:- cat aaa | awk -F '[, ]' '{cmd="date +%w -j -f %Y-%m-%d $2"; cmd|getline w; if(w>=1&&w<=5)print}'
- date: illegal time format
- usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
- [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
复制代码 |
|