Editing multiple lines that fall in a certain place

2013-04-08
2013-04-13
  • Mark Williams

    Mark Williams - 2013-04-08

    I need to edit multiple lines that fall in a particular place on a page.

    For instance, the file looks like this:

    Page 1
    Line1
    Line2
    Line3
    Line4
    end of page
    Page 2
    Line1
    Line2
    Line3
    Line4
    end of page
    Page3
    Line1
    Line2
    data line
    Line3
    Line4

    Here is how they need to be... If it is not page 1, and Line3 and Line4 fall right under Line2, Line3 and Line4 need to be taken out. So it should look like this:

    Page 1
    Line1
    Line2
    Line3
    Line4
    end of page
    Page 2
    Line1
    Line2
    end of page
    Page3
    Line1
    Line2
    data line
    Line3
    Line4

    There would be multiple Page 1's in the file.

    Thanks

     
  • cchris

    cchris - 2013-04-13

    USe some scripting tool. I tend to recommend Awk when doing line based tricks, but Python, via the Python Script plugin, would do just as well. I assume you have a clear way of telling whether a line is a line2, a data line or what else.

    CChris

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks