![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Web Programming, Web 2.0 and Mashups Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, Flash, HTML, SEO, Mashups and other Web APIs and topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting Binary decimal coded values to Ascii Values | gaur.deepti | UNIX for Advanced & Expert Users | 3 | 04-02-2008 12:33 PM |
| replace the column values. | charandevu | Shell Programming and Scripting | 6 | 04-02-2008 02:21 AM |
| replace a column values with the first value in column | sumeet | UNIX for Advanced & Expert Users | 3 | 02-06-2007 01:13 PM |
| xor 2 values in ksh? | DukeNuke2 | Shell Programming and Scripting | 5 | 11-08-2006 12:38 PM |
| Replace spaces with 0's having numeric values. | videsh77 | Shell Programming and Scripting | 1 | 04-15-2005 01:22 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Replace xml values
Hallo all,
I try to create a bash script but till now without any positiv results. The script should replace different variables in a text file with the right xml values Look at the following xml file: file.xml =================================== <?xml version="1.0" encoding="UTF-8"?> <Daten> <export_date>2008-07-15 16:29:01</export_date> <language>english</language> =================================== temp.txt =================================== All dates were exported at <export_date> The text was translated in <language> =================================== script.sh =================================== #!/bin/bash IFS=$'\n' for i in `cat file.xml | sed 's/>/ /g' | awk '{print $1}' | sed 's/</ /g' | sed 's/ //g'` do for j in `grep "$i" temp.txt | sed 's/.*<//g'| sed 's/>.*//g' ` do #echo $j for h in `cat temp.txt | sed -e "s/"$j"/$(cat file.xml | grep "$j" | sed 's/>/ /g' | sed 's/</ /g' | awk '{print $2}')/g" >> temp2 ` do echo $h done done done ================================================== The aim should be All dates were exported at 2008-07-15 16:29:01 The text was translated in english. Do you know how I could work on this? thx |
|
||||
|
No duplicate or cross-posting, read the rules.
Proceed here: Replace xml values -- Shell -- Thread closed. |
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|