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...
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