Can ruby do this?

Discussion in 'Ruby' started by no.top.post, Dec 1, 2011.

  1. no.top.post

    no.top.post Guest

    Consider files represented thus:
    X123456abcd|Y123456efg|Z123456hijk|

    Where:
    X,Y,Z are <header/description lines>
    | is the line which terminates/separates each of the [3 in this case]
    sections of the file.
    1,2...6 are lines that are repeated [hence redundant] in each section.
    a,b,....k are the lines of CONTENTS that you want to end up with.

    The algorithm may be something like this:
    IF any 3 or more consecutive lines of the 1st section
    are repeated in any of the following sections
    THEN delete these <repeats>.

    So you want to end up with:
    X123456abcd|Yefg|Zhijk|

    PS. this problem is a further refinement of
    < with MaxLineLen= 77 ; lynx-fetch the filed-list-of-URLs and
    append them to File2, each with its header & separator. >

    You want to delete the repeated garbage.
    Like if you d/l 8 pages of a 'publication' each page will have the same
    47-line 'header'.

    So you want to discard the redundant packaging.

    == TIA.
     
    no.top.post, Dec 1, 2011
    #1
    1. Advertisements

  2. Yes.

    robert
     
    Robert Klemme, Dec 1, 2011
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.