
I have 2 files a & b
Contents of a are:-
This is a Good Boy
This is a Good Boy
This is a Very Good Boy
This is a Good Boy
This is a Good Boy
The contents of b are
This is Testing Beta
I have a piece of code :-
i=`cat a|grep "Very Good"`
echo $i
perl -pi -e 's/^(This is a Very Good Boy)/$1."\n".`cat b`/e' a
Now the above piece of code works perfectly well. That is String 'This is Testing Beta', needs to be added just under the string ''This is a Very Good Boy', followed by the remaining lines of code from file a. However, I want to refrence Shell variable 'i' instead of hard coding the string 'This is a Very Good Boy'? Please help urgent.
Any other forms of help are also welcome, I mean if we could do the above effort with just Shell,awk,sed or combination of all 3. All your help is highly appreciated.
Regards
Sri

The Final Output Should look something like this. I mean the final contents of File a
----------------------
This is a Good Boy
This is a Good Boy
This is a Very Good Boy
This is Testing Beta
This is a Good Boy
This is a Good Boy
-------------------------