Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49648

Re: Parsing Text file

Newsgroups comp.lang.python
Date 2013-07-02 12:30 -0700
References <08ae2828-1532-47b6-a9cb-208549189467@googlegroups.com> <b3gnnaFbe60U1@mid.individual.net>
Message-ID <8ea32ea7-2cee-4e61-8cbd-066721d88d4a@googlegroups.com> (permalink)
Subject Re: Parsing Text file
From sas429s@gmail.com

Show all headers | View raw


Somemore can be anything for instance:

Sometext
mail
maskit

Sometext
rupee
dollar
maskit

and so on..

Is there a way I can achieve this?

On Tuesday, July 2, 2013 2:24:26 PM UTC-5, Neil Cerutti wrote:
> On 2013-07-02, sas429s@gmail.com <sas429s@gmail.com> wrote:
> 
> > I have a text file like this:
> 
> >
> 
> > Sometext
> 
> > Somemore
> 
> > Somemore
> 
> > maskit
> 
> >
> 
> > Sometext
> 
> > Somemore
> 
> > Somemore
> 
> > Somemore
> 
> > maskit
> 
> >
> 
> > Sometext
> 
> > Somemore
> 
> > maskit
> 
> >
> 
> > I want to search for the string maskit in this file and also
> 
> > need to print Sometext above it..SOmetext location can vary as
> 
> > you can see above.
> 
> >
> 
> > In the first instance it is 3 lines above mask it, in the
> 
> > second instance it is 4 lines above it and so on..
> 
> >
> 
> > Please help how to do it?
> 
> 
> 
> How can you tell the difference between Sometext and Somemore?
> 
> 
> 
> -- 
> 
> Neil Cerutti

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Parsing Text file sas429s@gmail.com - 2013-07-02 11:45 -0700
  Re: Parsing Text file Neil Cerutti <neilc@norwich.edu> - 2013-07-02 19:24 +0000
    Re: Parsing Text file sas429s@gmail.com - 2013-07-02 12:30 -0700
      Re: Parsing Text file Tobiah <toby@tobiah.org> - 2013-07-02 12:50 -0700
        Re: Parsing Text file Neil Cerutti <neilc@norwich.edu> - 2013-07-02 20:12 +0000
          Re: Parsing Text file sas429s@gmail.com - 2013-07-02 13:28 -0700
            Re: Parsing Text file Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 21:56 +0100
            Re: Parsing Text file Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-03 00:55 +0000
        Re: Parsing Text file Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 21:28 +0100

csiph-web