You can't delete lines from a file. You can copy a file while doing modifications to what is copied. So after opening the two files,
- While the source hasn't been exhausted,
- Read a line from the source.
- If line contains '1.0' or such a line was already found,
- Print the line to the destination.
As a one-liner:
perl -ne"print if $f ||= /1\.0/" infile >outfile
perl -i.bak -ne"print if $f ||= /1\.0/" file
Update: The above were for the Windows Command shell. Below are adaptations for bash:
perl -ne'print if $f ||= /1\.0/' infile >outfile
perl -i~ -ne'print if $f ||= /1\.0/' file
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link
or How to display code and escape characters
are good places to start.