- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed "s/\//\\\//g"
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 03:39 AM
07-31-2001 03:39 AM
#com.hp.java.file.start=/etc/hp/dir1/dir2/dir3/myconfig.xml
VAL1=`echo $F | cut -d"=" -f1`
#com.hp.java.file.start
OLD=`echo $F | sed "s/\//\\\//g"`
#hoping to get com.hp.java.file.start=\/etc\/hp\/dir1\/dir2\/dir3\/myconfig.xml
VAL2=`echo $F | cut -d"=" -f2`
#/etc/hp/dir1/dir2/dir3/myconfig.xml
VALZ=`echo $VAL2 | sed "s/\/etc\/hp\///g"`
#dir1/dir2/dir3/myconfig.xml
VALZ2="$VAL2"
#/etc/hp/dir1/dir2/dir3/myconfig.xml
VALZ3=`echo $VALZ2 | sed "s/\//\\\//g"`
#\/etc\/hp\/dir1\/dir2\/dir3\/myconfig.xml<\/A>
NEW="${OLD}=${VALZ3}"
#Up to there it seems to do what I expect, but the following sed gets confused with all the /'s and \'s!
#How can I quote the sed properly still allowing variable substitution?
#I've tried all the ' " ` 's!
sed "s/`$OLD`/`$NEW`/g" ${PROPFILE} > ${PROPFILE}.tmp
mv ${PROPFILE}.tmp $PROPFILE
Later,
Bill
(PS, regarding my question yeste...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 04:03 AM
07-31-2001 04:03 AM
Solutionchange the delimiter, too many /'s ;)
sed "s;$OLD;$NEW;g" ${PROPFILE} > ${PROPFILE}.tmp
good luck,
Thierry.
BTW I would also change the
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 04:07 AM
07-31-2001 04:07 AM
Re: sed "s/\//\\\//g"
It should be like this:
sed s'/'$OLD'/'$NEW'/g' ${PROPFILE} >$PORPFILE}.tmp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 04:16 AM
07-31-2001 04:16 AM
Re: sed "s/\//\\\//g"
On posix
sed s/${OLD}/${NEW}/g
seems to be working fine for me..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2001 04:41 AM
07-31-2001 04:41 AM
Re: sed "s/\//\\\//g"
It's a type of collectinfo based on the nickel script by Robert Sakic of the German Response Center only that I've modified it to add some more stuff. I'll email him my copy and see if he want's to keep my bits in any case.
See www.grc.hp.com/docs/nickel/
for the original script.
Later,
Bill