Hi,
I have thousands of files with the following format:
0.642375 125 SIL
1.0705 125 ઔર્
1.3651875 125 આત્
1.519875 125 મ
...
...
...
7.2140627 125 સે
7.478125 125 હટ્
7.622625 125 જા
7.956125 125 ઓ
8.192375 125 SIL
8.252 125 SIL
8.464 125 SIL
8.706 125 SIL
... and so on
Also, the number of lines are not same in all the files. I just want one line with SIL at the end (shown in red) and wish to get rid of the others following it.
Can anyone help me how can I resolve this using perl? I'd be great if i can input all the files at a time process it and save it back with required lines. I am acquainted with file handling. All I seek help for is the formatting (i.e., getting rid of those extra lines). Thank you.


In reply to removing lines that are in the end of a file by bhargavkanakiya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.