Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'python.': 0.02; 'mentioned,': 0.07; 'suggest': 0.11; 'files.': 0.13; ':-)': 0.13; 'value.': 0.15; 'blocks': 0.16; 'subject:File': 0.16; 'subject:Text': 0.16; 'wrote:': 0.17; 'changes': 0.20; 'file.': 0.20; 'to:2**1': 0.23; 'header': 0.24; 'tried': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'in.': 0.27; 'module.': 0.27; 'mining': 0.29; "i'm": 0.29; 'code': 0.31; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'text': 0.34; 'especially': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'too': 0.36; 'best,': 0.37; 'well.': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'first': 0.61; 'traffic': 0.61; 'worth': 0.63; 'received:204': 0.72; 'distinguish': 0.84; 'hard.': 0.84; 'results,': 0.91; 'subject:From': 0.97 Date: Mon, 27 Aug 2012 13:55:52 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Huso , python-list@python.org Subject: Re: Extract Text Table From File References: <481dc39d-1dee-4ebe-97d5-ccad659f8c74@googlegroups.com> <8e48635a-f873-40ce-b886-2ffc058f9eb4@googlegroups.com> In-Reply-To: <8e48635a-f873-40ce-b886-2ffc058f9eb4@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346068558 news.xs4all.nl 6926 [2001:888:2000:d::a6]:37387 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27979 On 2012-08-27 13:23, Huso wrote: > Hi, > > There can be any number of blocks in the log file. > I distinguish the block by the start header 'ROUTES TRAFFIC RESULTS, LSR' and ending in 'END'. Each block will have a unique [date + time] value. > > I tried the code you mentioned, it works for the data part. > But I need to get the TRG, MP, DATE and TIME for the block with those data as well. This is the part that i'm really tangled in. > > Thanking, > Huso Well, I suggest that you try to understand my code and make changes in it. It is not too hard. First you start reading documentation of the "re" module. It is worth learning Python. Especially for mining data out of text files. :-) Best, Laszlo