Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'subject:Python': 0.04; 'bits': 0.07; 'python': 0.07; '"done"': 0.09; 'output': 0.12; '"r")': 0.16; '"w")': 0.16; 'answered.': 0.16; 'subject:Convert': 0.16; 'subject:regex': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'script': 0.26; 'looks': 0.28; 'string': 0.29; 'from:addr:googlemail.com': 0.29; 'query': 0.29; 'probably': 0.30; 'cc:addr:python.org': 0.31; 'filtering': 0.31; 'thank': 0.32; 'file': 0.35; 'done.': 0.35; 'print': 0.35; 'header :User-Agent:1': 0.35; 'hello,': 0.36; 'skip:o 20': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'log': 0.38; 'much.': 0.39; 'end': 0.39; 'finished': 0.40; 'learn': 0.60; 'best': 0.60; 'taking': 0.61; 'back': 0.61; 'received:74.125.83': 0.69; 'to:addr:googlegroups.com': 0.69; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'received:74.125.83.56': 0.84; 'received:mail-gw0-f56.google.com': 0.84; 'reply- to:addr:googlegroups.com': 0.93 Newsgroups: comp.lang.python Date: Tue, 17 May 2011 03:07:34 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.233.250.6; posting-account=cLrwyAoAAAB9UeiSeYmBPmVn0SNqa__5 User-Agent: G2/1.0 MIME-Version: 1.0 Subject: Re: Convert AWK regex to Python From: J To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: comp.lang.python@googlegroups.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 28 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305626865 news.xs4all.nl 49181 [::ffff:82.94.164.166]:51757 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5557 Hello, I have managed to get my script finished in the end by taking bits from eve= ryone who answered. Thank you so much. the finished query string looks li= ke this (still not the best but it gets the job done. Once I learn to code= more with Python I will probably go back to it and re-write it):- # Log file to work on filetoread =3D open("/tmp/pdu.log", "r") # Perform filtering in the log file text =3D filetoread.read() text =3D text.replace("