New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

edit XML file using variable in shell script.

Post Reply New Thread Subscribe

Thread Tools

Member Since: Feb 01, 2009
Posts: 2
jc6 is on a distinguished road

jc6 is offline

I am trying to edit a XML file using a shell script, but having some issues. Any help would be great.

I would like to edit the following string in a XML file that will be copied to a computer using a shell script.

When the file is copied to the machine, the value will have the following:

I would like to use a variable I have created in the shell script $COMPUTERNAME when changing the value. Below would be the desired output


Any ideas or suggestions would ge great.
QUOTE Thanks

Member Since: Feb 01, 2009
Posts: 2
jc6 is on a distinguished road

jc6 is offline
Thanks guys, i was able to figure it out.. This seems to work.
sed "s/computer/$COMPUTERNAME/" /test.xml > /test2.xml
QUOTE Thanks

Post Reply New Thread Subscribe

« Write date and time to .txt in terminal | Record Amplitude Readout »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Making a Shell Script Executable surfwax95 OS X - Development and Darwin 10 08-25-2010 04:15 PM
Show Item Info inflexion OS X - Operating System 15 10-24-2005 10:34 PM
Shell script question Niwrad OS X - Development and Darwin 14 06-28-2005 04:58 PM
Shell Script on Desktop starrin OS X - Operating System 2 07-28-2004 11:25 AM
tsch script - nested loop dynamic variable reference lizardthefish OS X - Development and Darwin 0 03-04-2004 11:53 PM

All times are GMT -4. The time now is 03:53 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?