Hi,
I am working on a script, part of which does a string replacement. The user needs the ability to:
01) Enter a string that optionally contains embedded spaces.
02) Enter a string that optionally contains a double quote.
The following works just fine for (01):
Example: Change occurances of Oldstuff to NEW text
sed s/""Oldstuff"/""NEW text""/ /home/guest/tmp/old.dat > /home/guest/new.dat
The problem I am having is in getting the correct combination of double quotes (or whatever) characters to permit the final string to optionally maintain a double quote around the replaced data.
Example: Change occurances of Oldstuff to "NEW text" where the data is embraced by a double quote on each end.
I've tried a bunch of things without success.
Any ideas?
Thank you,
gawker
"Once the landslide has begun, it is too late for the pebbles to vote." Kosh, B5
I am working on a script, part of which does a string replacement. The user needs the ability to:
01) Enter a string that optionally contains embedded spaces.
02) Enter a string that optionally contains a double quote.
The following works just fine for (01):
Example: Change occurances of Oldstuff to NEW text
sed s/""Oldstuff"/""NEW text""/ /home/guest/tmp/old.dat > /home/guest/new.dat
The problem I am having is in getting the correct combination of double quotes (or whatever) characters to permit the final string to optionally maintain a double quote around the replaced data.
Example: Change occurances of Oldstuff to "NEW text" where the data is embraced by a double quote on each end.
I've tried a bunch of things without success.
Any ideas?
Thank you,
gawker
"Once the landslide has begun, it is too late for the pebbles to vote." Kosh, B5