Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5499
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.04; 'python': 0.07; 'pm,': 0.11; 'wrote:': 0.14; 'awk': 0.16; 'grep': 0.16; 'subject:Convert': 0.16; 'subject:regex': 0.16; "that'll": 0.16; '16,': 0.16; 'command': 0.19; 'header:In-Reply-To:1': 0.22; 'mon,': 0.22; 'received:209.85.214.174': 0.23; 'received:mail- iw0-f174.google.com': 0.23; 'instead': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'sort': 0.30; 'to:addr:python- list': 0.32; 'done': 0.32; 'things': 0.33; 'print': 0.35; 'received:209.85': 0.37; 'received:google.com': 0.38; 'received:209.85.214': 0.39; 'likely': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; '2011': 0.62; 'point:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=2lQtwgM7b1zvvEo0MR56CHF5khsbZjcpT4EE0tb+oys=; b=rcIPlJI3tteY2EL3RkpSc5k7ofuY6InptlA0gRcq3Qk7LhdT+Vcbcllp6jiZMdpjad PORnhUA77M18akRRstx26OdgIV8XHWT9Ft0UE4eswk1nBHnETnMyY7Vmvmt9HvOFiHDS MMOV6oiNyEUVKNRFKTmH7RCTwOqnUIaEztJqs= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=GVvVyraIwJQaIjONq9k/o991NrxBxoxk4Hl1rS3mr/WIR2Z8LnX+WR3JO8kKe0FVfE RG9sd9wVCo9kDKHIGFjbbLh/UyTjlyI4ed4Sntkch/uBGjna/F33EpiEXaHiHVx2Yx/9 tgPo6taHHqFQPi93sJ+HzqZISLl59TVEBN0OY= |
| MIME-Version | 1.0 |
| In-Reply-To | <d4b4303e-8002-4f5f-9cb8-af7ab7451f13@glegroupsg2000goo.googlegroups.com> |
| References | <d4b4303e-8002-4f5f-9cb8-af7ab7451f13@glegroupsg2000goo.googlegroups.com> |
| Date | Mon, 16 May 2011 18:31:03 +1000 |
| Subject | Re: Convert AWK regex to Python |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1633.1305534667.9059.python-list@python.org> (permalink) |
| Lines | 11 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1305534667 news.xs4all.nl 41103 [::ffff:82.94.164.166]:41027 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5499 |
Show key headers only | View raw
On Mon, May 16, 2011 at 6:19 PM, J <jnr.gonzalez@googlemail.com> wrote:
> cat logs/pdu_log_fe.log | awk -F\- '{print $1,$NF}' | awk -F\. '{print $1,$NF}' | awk '{print $1,$4,$5}' | sort | uniq | while read service command status; do echo "Service: $service, Command: $command, Status: $status, Occurrences: `grep $service logs/pdu_log_fe.log | grep $command | grep $status | wc -l | awk '{ print $1 }'`" >> logs/pdu_log_fe_clean.log; done
Small side point: Instead of "| sort | uniq |", you could use a Python
dictionary. That'll likely speed things up somewhat!
Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Convert AWK regex to Python J <jnr.gonzalez@googlemail.com> - 2011-05-16 01:19 -0700
Re: Convert AWK regex to Python Chris Angelico <rosuav@gmail.com> - 2011-05-16 18:31 +1000
Re: Convert AWK regex to Python Peter Otten <__peter__@web.de> - 2011-05-16 12:07 +0200
Re: Convert AWK regex to Python Giacomo Boffi <giacomo.boffi@polimi.it> - 2011-05-16 16:19 +0200
Re: Convert AWK regex to Python Matt Berends <matthewberends@gmail.com> - 2011-05-16 08:02 -0700
Re: Convert AWK regex to Python MRAB <python@mrabarnett.plus.com> - 2011-05-16 17:39 +0100
csiph-web