回复 1# 娜美
gawk( http://bcn.bathome.net/tool/4.1.0/gawk.exe )的解决方案如下。
将以下脚本以ANSI编码格式保存为filter.awk,在命令行窗口下执行:gawk -ffilter.awk *.txt 即可- BEGIN {
- FS = "\t"
- split("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", month, /,/)
- for (i in month) {
- m_digit[month[i]] = i
- }
- }
- b3 == 1 && $3 == 2, $3 == 3 {
- if (b3 == 1 && $3 == 2) {
- bb2 = b2
- bb5 = b5
- oID = 1
- }
- if ($3 > 3 || $3 < 2) {
- oID = 0
- }
- if (($3 == 3) && (bb5 == $5) && (oID == 1)) {
- Dt = c_sec($2) - c_sec(bb2)
- if ((Dt <= 2) && (Dt >= -2)) {
- print FILENAME
- nextfile
- }
- }
- }
- {
- b3 = $3
- b2 = $2
- b5 = $5
- }
- function c_sec(dat)
- {
- split(dat, t, /[ :,.]+/)
- return mktime(sprintf("%4d %02d %02d %02d %02d %02d", t[3], m_digit[t[1]], t[2], t[4], t[5], t[6]))
- }
复制代码
|