I have a group of xml files and I need to insert 3 parameters just after this line in each file:
---------------Pattern to be searched for-------------------------
<!--The following configuration is a test configuration-->
---------------Parameters to be added---------------------------
<Parameter>
<Name>NamedThreadsEnableLocking</Name>
<Value>true</Value>
</Parameter>
This is wonderful use of sed. I have another query on the same situation, What if i need to append or insert a few more lines BEFORE a particualr string.
Thank u so much, But i did not understand that newbie here .
Here is what i m looking for :-
i have a file that has a word "[IPAddr]" mentioned in it.
i need to add contents of "append.txt" above this word in this file.
The word "[IPAddr]" can be any where in the file.
Here is a shell script that will do the same thing.
#! /bin/ksh
> output.txt
while read line
do
if [[ "$line" == *IPAddr* ]] ; then
cat append.txt >> output.txt
fi ;
echo "$line" >> output.txt
done < input.txt