in reply to Re: insert line of text above a line
in thread insert line of text above a line
C:\>perl -pe"if($_eq'baz-123'){print'bar=2'}" old > new String found where operator expected at -e line 1, near "123'){print'" (Missing operator before '){print'?) Bareword found where operator expected at -e line 1, near "'){print'ba +r" (Missing operator before bar?) String found where operator expected at -e line 1, at end of line (Missing semicolon on previous line?) syntax error at -e line 1, near "123'){print'" Can't find string terminator "'" anywhere before EOF at -e line 1.
Why not use the -i command line option?
Since baz is the only constant, it should be =~ /baz/ and not eq
print 'bar=2' wtf is the newline?
Thanks for broken code that would not do the job even if it worked
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: insert line of text above a line
by Anonymous Monk on Sep 26, 2003 at 12:29 UTC |