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

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


Reply via email to