When I am using "sed" in the command line then it is working but when the Pearl script is not included has been done.
An example sed 's / \ s + // g' aaa & gt; BBB
But say I'm trying to call the same order via perl script
$ gf = 'sed' s / S \ + //G 'AAA & gt; BBB`; The output file remains the same as the input file !!!! Please suggest.
In Perl, backlit has only one escape and interpolation rules such as two quoted strings: a backslash Make the unknown escape code forget the backslash, eg "\." Eq "." ".
Therefore, the Perl code
print \ echo" 1 \ "` print 'echo \\ "1 \\" `; < / Code> output
1 "1" If you want to embed that code, then Sed command in Pearl, you must avoid backslash so that they sh alay:
$ gf = 'sed' s / \\ s \\ Actually, you will not get any output in $ gf because you can not output any Let's redirect to the file. Can use Autodi; The system "sed 's / \\ s \\ + // g' aaa & gt; Bbb "; or with single quotes:
use autodyne; system q (sed) / \ s \ + // g 'aaa which keeps backslash.
However, this is unnecessary because the Perl replacement can apply itself. Use Autodie; # Automatic Error Handling Open My $ Out, "& gt;", "BBB"; Open your IN $, "& lt;", "AAA"; While (& lt; $ In & gt;) {s / \ s \ + // g; # Remove all locations with a plus print {$ out} $ _;}
No comments:
Post a Comment