[SLE] [Somewhat OT] Getting the middle part of a file.

From: The Purple Tiger (Jon_at_tigersden.demon.co.uk)
Date: 09/18/03

  • Next message: Keith Powell: "Re: [SLE] Abiword Spelling (Resend)"
    To: suse-linux-e@suse.com
    Date: Thu, 18 Sep 2003 14:03:16 +0100
    
    

    Hey all,
            This is a bit OT, but not so OT as to go to the OT list IMHO :)

    System is SuSE8.2

    What I am trying to do:
    I have a large number of html files that have a segment in them I would
    like to copy out and save to another file.

    The segment I want is after a unique table tag [unique in that whilst
    there are other table tags, there are none like this one, and it is the
    same in each file]. I want to capture up until the closing table tag.

    ALSO I am trying to make sure that the first 4 lines [if you include the
    table tag] and the last 4 lines [if you include the closing tag] don't
    get copied to the file :)

    I don't ask for much, do I? ;)

    What I have discovered so far:
    I can use:
    grep -i "table tag stuff goes here"

    to get the first line, without case mattering [which isn't essential as
    I think they are all exactly the same, but just in case...]. I can
    even:
    grep -iA 10 "table tag stuff goes here"

    to get the 10 lines of output including the matching line.

    I can use -B instead to get the 10 lines preceding the table tag at the
    end, if it is unique [which the closing tag isn't].

    Anyone have any good 1 or 2 liners that would help me out here? Or maybe
    something a bit longer :)

    Thanks for reading this :)

    -- 
    Check the headers for your unsubscription address
    For additional commands send e-mail to suse-linux-e-help@suse.com
    Also check the archives at http://lists.suse.com
    Please read the FAQs: suse-linux-e-faq@suse.com
    

  • Next message: Keith Powell: "Re: [SLE] Abiword Spelling (Resend)"

    Relevant Pages

    • Re: [SLE] [Somewhat OT] Getting the middle part of a file.
      ... > I have a large number of html files that have a segment in them I would ... I want to capture up until the closing table tag. ... You should can use a Perl script to do this. ... Non enim propter gloriam, diuicias aut honores pugnamus set propter ...
      (SuSE)
    • Re: americans win 40% of all nobel science prizes
      ... Garamond Lethe wrote: ... Home Companion", the tag line of that segment being "Where all the ...
      (talk.origins)
    • RE: [SLE] [Somewhat OT] Getting the middle part of a file.
      ... > The segment I want is after a unique table tag [unique in that whilst ... I want to capture up until the closing table tag. ... > Check the headers for your unsubscription address ...
      (SuSE)
    • Re: CSS Safari Problem (Mac)
      ... The closed meta tag was copied and pasted from Google's Webmaster ... I assumed that closing all elements in HTML was ... optional (e.g. closing tag of is optional). ... In the case of xhtml, ...
      (alt.html)
    • Re: RFC: thoughts for a "streamlined" XML syntax variant...
      ... given the intention that the new syntax be a direct extension of the ... determining the type of the next matching closing tag, ... b begins, scans forwards, sees that next closing tag is a, concludes it ... Or, equivalently, with just a recursive parser. ...
      (comp.text.xml)