Hi,
ghostdog74's comment in post #8 is true in your case, the following code is a tiny bit simpler due to that change:
Code:
#!/bin/bash
rndString=$(awk '
BEGIN {
split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", choices, "")
srand(systime())
i = 1
while ( i <= 40 ) {
printf("%s", choices[int(1 + rand() * 61)])
i++
}
print ""
}')
sed -i.bak "s%<string>.*</string>%<string>$rndString</string>%" infile