I need to write a simple script to replace a block of text in a configuration file with the contents of another file.
Let\'s assume with have the following simplifie
You may also use the ed command (cf. http://wiki.bash-hackers.org/howto/edit-ed ):
cat <<-'EOF' | sed -e 's/^ *//' -e 's/ *$//' | ed -s server.xml H /BEGIN realm/i . /BEGIN realm/+1,/END realm/-1d .-1r realm.xml wq EOF