Mallya, Vaibhav U wrote:
Hi All,

Hello,

I need to used some perl code in k and C shell. But it is giving me bad
substitution. Same code works fine in bash. Any help would be
appreciated.

perl -i -e '$re=q~'${1//~/\\~}'~; print "$re"; while (<>) { /$re/ ? $c++
: print;}exit($c ? 0 : 1)' /home/vmallya/testing || echo " Delete of
lines containing."}
ksh: "\$re=q~"${1//~/\\~}"~; print \"\$re\"; while (<>) { /\$re/ ? \$c++
: print;}exit(\$c ? 0 : 1)": bad substitution

This may work better:

perl -i -ne'BEGIN { ($re = shift) =~ s/~/\\~/g; print $re } /$re/ ? ++$c : print; END { $c && print " Delete of lines containing." }' "$1" /home/vmallya/testing




John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to