adding the data at a specified location in a file....

Hi all,
I m new to shell programming..Can anyone please guide me how to insert data at a specified location in the file..
I have a configuration file..I want to add data to it through script..I am able to do it...I get that data written at end of my configuration file..I want data to be placed at a specified location...
As,I have a header [mydata] in my configuration file..I want to place the data here...
Is it possible to do that...
Example:
My configuration file:
[global]
hello
aaa
bbbb
[share]
gghg
hnnmm
bbb
[mydata]
gggg
[printing]
cvbvbb
vbvbb
Now,I want my data to be entered after header [mydata], not at the end of Configuration file...

Thanking you...

Try this:

awk -v dat="Yourdata" '/\[share\]/{print;print dat;next}1' file > newfile

Regards

sed '/\[mydata\]/a\all i ever wanted\nall i ever needed\nis here in my arms' infile
[global]
hello
aaa
bbbb
[share]
gghg
hnnmm
bbb
[mydata]
all i ever wanted
all i ever needed
is here in my arms
gggg
[printing]
cvbvbb
vbvbb

Hi,
Thanks so much..This has helped me to understand the concept...
Actually,This is my script which inserts the data into the configuration file..

#!/bin/bash
CF="/etc/samba/smb-test.conf" //Configuration file
.....................
...............

insert_mod() { //Function to insert data into config file
NCF="$CF.$$"
[ ! -f $CF ] && touch $CF || :
V="$1"
grep -v -E "^$V=" $CF > $NCF
mv -f $NCF $CF
eval echo "$V\"'\${$V}'\"">> $CF

}
hello=yes
insert_mod hello //Function called with argument
else
illegal
fi

...............
SO,HOW CAN I USE sed COMMAND HERE....

Thanking you in advance...