0

私はファイル log.txt を持っています:

======================
Tue Jun 25 00:02:00 WIT 2013
======================


pool
    INFO     name               work
    INFO     threads.total      30
    INFO     threads.active     7
    INFO     threads.waiting    23
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   139
    INFO     jobs.queue.tps     3
    INFO     jobs.start.tps     3
    INFO     jobs.finish.tps    3
    NORMAL   jobs.count         0
pool
    INFO     name               recv
    INFO     threads.total      40
    INFO     threads.active     27
    INFO     threads.waiting    13
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   0
    INFO     jobs.queue.tps     0
    INFO     jobs.start.tps     0
    INFO     jobs.finish.tps    0
    NORMAL   jobs.count         0
pool
    INFO     name               send
    INFO     threads.total      10
    INFO     threads.active     0
    INFO     threads.waiting    10
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   1
    INFO     jobs.queue.tps     5
    INFO     jobs.start.tps     5
    INFO     jobs.finish.tps    5
    NORMAL   jobs.count         0


======================
Tue Jun 25 00:03:00 WIT 2013
======================

pool
    INFO     name               work
    INFO     threads.total      30
    INFO     threads.active     15
    INFO     threads.waiting    15
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   13
    INFO     jobs.queue.tps     1
    INFO     jobs.start.tps     0
    INFO     jobs.finish.tps    0
    NORMAL   jobs.count         46
    INFO     jobs.1.type        request

pool
    INFO     name               recv
    INFO     threads.total      40
    INFO     threads.active     27
    INFO     threads.waiting    13
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   0
    INFO     jobs.queue.tps     0
    INFO     jobs.start.tps     0
    INFO     jobs.finish.tps    0
    NORMAL   jobs.count         0
pool
    INFO     name               send
    INFO     threads.total      10
    INFO     threads.active     0
    INFO     threads.waiting    10
    INFO     jobs.queue.latency 0
    INFO     jobs.run.latency   0
    INFO     jobs.queue.tps     0
    INFO     jobs.start.tps     0
    INFO     jobs.finish.tps    0
    NORMAL   jobs.count         0

私はこのような結果が欲しい:


======================
Tue Jun 25 00:03:00 WIT 2013
======================
    INFO     name               work
    NORMAL   jobs.count         46
    INFO     jobs.1.type        request

私はすでに使用しています:

cat log.txt |grep -B14 -A1 -i 'jobs.count         [1-9]\{2,\}' |
egrep -i "jobs.1.type|=|WIT|jobs.count         [1-9]"

name が「work」ではなく「send」または「recv」の場合の問題で、「grep -B14」では日付が取得されません。他の解決策はありますか?一方、get date ="Tue Jun 25 00:03:00 WIT 2013" よりも "jobs.count" not "0" の場合は grep が必要で、get name ="INFO name work" および get jobs type "INFO jobs" .1.type リクエスト":

4

2 に答える 2