Ah yes, now the real stumper:
The line:
perl -pi -e 's/<provider-url>file:.*<\/provider-url>/REPLACED/' testfile.txt
does in fact work fine from the commandline in unix.
However, when it is called from a ksh script, it does not function. Any ideas? I have
tried many possible combinations that I can think of.
Thanks very much.
Randy
-----Original Message-----
From: drieux [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 7:04 PM
To: Perl Beginners Mailing List
Subject: Re: command line search and replace
On Dec 30, 2003, at 4:51 PM, Randy Brown wrote:
> When I try the following, perl reads the * as a literal character,
> instead of my intent as a global value. Anyone see what I am missing?
>
> perl -pi -e "s/<provider-url>file:*<\/provider-url>/REPLACED/g"
> testfile.txt
you might want to revisit
perldoc perlretut
since what you are in the midst of is a regular expression
and it is not clear to me that you really wanted to assert
zero or more ":"
rather than say
zero or more "any characters"
which would have been
perl -pi -e "s/<provider-url>file:.*<\/provider-url>/REPLACED/g"
testfile.txt
"." is the "wild card" character, which you want to have
zero or more of, yes?
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
-------------------------------------------------------------------------------------
The information contained in this message is proprietary of Amdocs,
protected from disclosure, and may be privileged.
The information is intended to be conveyed only to the designated recipient(s)
of the message. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, use, distribution or copying of
this communication is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by replying to the message and deleting it from your computer.
Thank you.
-------------------------------------------------------------------------------------
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>