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


Groups > comp.lang.python > #49647

Re: Parsing Text file

From Neil Cerutti <neilc@norwich.edu>
Newsgroups comp.lang.python
Subject Re: Parsing Text file
Date 2013-07-02 19:24 +0000
Organization Norwich University
Message-ID <b3gnnaFbe60U1@mid.individual.net> (permalink)
References <08ae2828-1532-47b6-a9cb-208549189467@googlegroups.com>

Show all headers | View raw


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