Page 1 of 1

Unix scripts change

Posted: Mon Mar 24, 2008 4:04 pm
by reddysrc
Hi Experts,

I had 150 unix (AIX) shell scripts in dev directory, i need to change of some params in all scripts ( like /opt/dataste/prod to /opt/datastage/dev ) path names in all shell scripts.

Is there any single unix command to replace "prod" with "dev" .

let me know possible unix commands to change all shell scripts patchs with a singe shot.

Thanks
Rama

Posted: Mon Mar 24, 2008 4:20 pm
by trammohan
/opt/dataste/prod to /opt/datastage/dev

Hi ,

try this one

for i in `ls *.ksh`
do
sed 's/\/opt\/datastage\/prod/\/opt\/datastage\/dev/g' $i > ${i}_new
mv ${i}_new $i
done

hope this helps.....

Posted: Mon Mar 24, 2008 4:31 pm
by kumar_s
Perhaps just 's/prod/dev/g' and as not the whole path.

Posted: Mon Mar 24, 2008 4:56 pm
by chulett
Make sure you save a copy of them all before you start, just in case this destroys them all. :wink:

Posted: Mon Mar 24, 2008 4:58 pm
by kumar_s
Always Craig hopes the best!

Posted: Mon Mar 24, 2008 5:02 pm
by ray.wurlod
I suspect it's more to do with not having to spend lots of non-billable time re-creating what's been destroyed.