Hi all,
I'm not sure but I guess, that is a bash version issue.
The script working fine on "GNU bash, version 3.2.25(1)-release Ubuntu".
#!/bin/bash
while IFS=">" read a id val
do
if [[ "$id" =~ "</" ]]
then
VAL=${id%<}; ID=${id#</}
echo $VAL
echo $ID
sed "s|<${ID}>|${VAL}|" temp.txt >> temp
mv temp temp.txt
fi
done < file2.xml
but not running on "GNU bash (C) 2.05 SUSE".
Error message:
line 5: conditional binary operator expected
line 5: syntax error near `=~'
line 5: ` if [[ "$id" =~ "</" ]]
Any suggestions?