Operating System - HP-UX
1843974 Members
2155 Online
110226 Solutions
New Discussion

Modifying CONFIG-SPECS using shell scrip

 
Amit Dixit_2
Regular Advisor

Modifying CONFIG-SPECS using shell scrip

Hi,
I want to write a shell script to modify
config-specs of clearcase

how should I go about it and
there is an entry
MAP_014
i want to ask user whether he wants to
update this if the user gives new number
say 15 then my script should update it to
MAP_015

How should i do that ?

Thanks,
Amit
4 REPLIES 4
Steve Steel
Honored Contributor

Re: Modifying CONFIG-SPECS using shell scrip

Hi


read number?"Input number>"
typeset -Z3 value=$NUMBER
param=MAP_"$value"


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Amit Dixit_2
Regular Advisor

Re: Modifying CONFIG-SPECS using shell scrip

Hi,
Following is my script
echo "Enter the New Release Module
Number For MAP :"
read mapno
typeset -Z3 value=$mapno
param=MAP_"$value" >>config-specs

Below is the config-specs file
MAP_014
RPR_013
LRP_010

But it doesnt work

Thanks,
Amit

Muthukumar_5
Honored Contributor

Re: Modifying CONFIG-SPECS using shell scrip

Do you want to change the number of 15 (example) to all entries in config-specs file

Then do it as,

echo "Enter the New Release Module
Number For MAP :"
read mapno
echo "`sed -e 's/_[0-9]*/_0'$mapno'/g' config-specs" > config-specs

Example:
if mapno=16
cat config-specs
MAP_014
RPR_013
LRP_010

mapno=16

sed -e 's/_[0-9]*/_0'$mapno'/g' config-specs
MAP_016
RPR_016
LRP_016

Above script will automatically update your file with out using temporary file

Or using perl as,

perl -p -i -e 's/_[0-9]*/_0'$mapno'/g' config-specs

Regards
Muthu
Easy to suggest when don't know about the problem!
Amit Dixit_2
Regular Advisor

Re: Modifying CONFIG-SPECS using shell scrip

Hi,
I have created the script to update the
release number.

I want to uncomment those modules which are
updated.

Eg when i run my script it display menu
like this

Enter the module number to update

1. M1 2. M2 3. M3 4. M4

Based upn the choice and new number
entered the module is updated

but my config-specs files looks like
this
#MAP_015
#RPR_016

I want when a module is update along with
updation of number i uncomment the same
line...

Please helllpppppppppp...

Thanks,
Amit