The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > Web Programming, Web 2.0 and Mashups
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-29-2008
research3 research3 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 88
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
  #2 (permalink)  
Old 11-29-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,300
No duplicate or cross-posting, read the rules.

Proceed here:

Replace xml values -- Shell --

Thread closed.
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On




All times are GMT -4. The time now is 04:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0