Re: [PBML] Re: A Perl Question (Was: Not a perl question)
- Thanks Damien..
Really it was an excellent solution. By using 'echo before and echo after' and by removal of the -i option... I could make out that the way I was invoking the command itself was wrong. Now I have corrected it and it is working fine.
Thanks for your timely support.
Damien Carbery <daymobrew@...> wrote:
--- In email@example.com, Sreeram B S <sreeramabsc@y...>
> Hi friends,silently. But the relevant changes that had to be done in the file are
> The script is not giving any errors or warnings. It is executing
> What may be the reason for this?Change the system() line to :
> I have also put on, the warning flag ie. #!/usr/bin/perl -w
> Need your help.
> Damien Carbery <daymobrew@y...> wrote:
> --- In firstname.lastname@example.org, Sreeram B S <sreeramabsc@y...>
> > Hi,
> > The command:
> > perl -pi -e 's/fmt1/fmt2/g' file1
> > will change all occurences of fmt1 with fmt2 and we get the
> results in file1 only.
> > But I am not able to use this command from a script..like this:
> > system("perl -pi -e 's/fmt1/fmt2/g' file1");
> > or `perl -pi -e 's/fmt1/fmt2/g' file1 `
> > Why is this happening..?
> > Please tell the modifications to the command(if any) to use it
> in the script.
> > Thanks in advance.
> > From,
> > Sreeram
> > snip old stuff
> I was had no problems using
> $ perl -pi -e 's/fmt1/fmt2/g' file1 # At command line
> system( "perl -pi -e 's/fmt1/fmt2/g' file1" );
> Are you getting any warnings?
> Are warnings on? Does your #! line have '-w' at the end.
system( "echo Before;perl -pi -e 's/fmt1/fmt2/g' file1;echo After" );
This will display "Before" and "After" in your console window to
confirm the command was run. Even when running correctly it runs
silently so there is no harm in generating some visual feedback.
Even better, remove the -i switch (change '-pi' to '-p') so the
modified lines are sent to STDOUT. You should see the modified lines.
Yahoo! Groups SponsorADVERTISEMENT
Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
[Non-text portions of this message have been removed]