On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> On 8/8/07, Jeff Pang <[EMAIL PROTECTED]> wrote:
> snip> perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file
>
> snip
>
> There is no need to keep track of the number of lines with a separate
> variable.  Perl already does this with the $. variable.  Also, a regex
> that replaces everything is pointless, just assign to $_.
>
> perl -pi -le '$_ = "something" if $. == 10' your_file

So if this was in a script rather than a oneliner how would it work?
I was playing and can not get it to work in an actual test script.

Thanks;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to