Replace and Append script

Closed
juju - Jan 31, 2012 at 09:44 AM
 juju - Jan 31, 2012 at 09:51 AM
Hello Folks,

I am a newbie in shell scripting, I have a xml file with following content

<node>
<name>test01</name>
</node>

I want to have these nodes to occur 2000 times i.e
<node>
<name>test0001</name>
</node>
<node>
<name>test0002</name>
</node>
...........
<node>
<name>test2000</name>
</node>

How can I achieve this, anybody got a script readily available. I can run it in unix, windows doesnt matter.

Any help or any pointers in right direction is appreciated.
Thanks in advance.
juju



2 responses

I came up with below script, but no luck.

#!/bin/bash
a=1
while ["$a" -le 5]; do
sed -i 's/test01/test"$a"/' /home/jsheriff/Downloads/Temp/jaldijaldi
cat /Temp/jaldijaldi >> /Temp/newfile
let a=a+1
done

When I run I see this error
/Temp$ . ./testloop.sh
[1: command not found
0
Anybody with ready made script to help me out .... plzzzzzzzzzzz
0