in reply to Re: perl -pie "???"
in thread perl -pie "???"

Hmmm it must be how I am invoking perl.

Here's the line I want to get rid of ...
$ head -1 DAR_RH9_install/index.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/ +/www.w3.org/TR/html4/loose.dtd">
Here's what I tried ...
$ perl -nie 'print if $. > 1' DAR_RH9_install/index.html Can't open perl script "print if $. > 1": No such file or directory $ perl -ie '<>; print while <>' DAR_RH9_install/index.html Can't open perl script "<>; print while <>": No such file or directory
What the heck I am doing wrong here?

Plankton: 1% Evil, 99% Hot Gas.

Replies are listed 'Best First'.
Re^3: perl -pie "???"
by bmann (Priest) on Aug 17, 2004 at 21:42 UTC
    Perl isn't seeing the -e switch. Anything immediately following the -i is assumed to be the backup extension, ie "perl -i.bak..." will create a backup named filename.bak and operate on the original.

    Use perl -i -e '...' (or -i.bak -e if you want a backup).

Re^3: perl -pie "???"
by hv (Prior) on Aug 17, 2004 at 21:42 UTC

    The -i switch takes an optional backup extension, so you can no longer combine it with other following option flags in modern perls. Write it instead as:

    perl -ni -e '...' file

    Hugo

Re^3: perl -pie "???"
by ikegami (Patriarch) on Aug 17, 2004 at 21:43 UTC
    Change perl -nie ... to perl -ni -e .... -i accepts an optional argument, so a space is needed after it.
Re^3: perl -pie "???"
by Anonymous Monk on Aug 17, 2004 at 21:43 UTC
    perl -ni -e 'print if $. > 1' filename