Replace Values In A Xml File

Adidas Con 4 Strisce Get Random Text From A File

A simple script that I've found and is used to replace xml value (like changing values in a configuration file)

#!/bin/bash
# bash 4.0 , using associative arrays
declare -A dict
while read -r line
do
    case "$line" in
        ""*|""*)
            tag=${line/home/gp/sites/antani.se/build/posts/2013/03/24/replace-values-in-a-xml-file.txt>*}
            tag=${tag#*<}
            val=${line#*>}
            val=${val/home/gp/sites/antani.se/build/posts/2013/03/24/replace-values-in-a-xml-file.txt<*}
            dict["$tag"]="$val"
            ;;
    esac
done < "$file2"
while read -r line
do
    case "$line" in
       ""*|""*)
        tag=${line/home/gp/sites/antani.se/build/posts/2013/03/24/replace-values-in-a-xml-file.txt>*}
        tag=${tag#*<}
        line="<$tag>${dict["$tag"]}"
    esac
    echo $line
done < "$file1"

Tags: linux bash