Hi.
Here is one solution:
Code:
#!/bin/sh
# @(#) s1 Demonstrate sed line split.
set -o nounset
echo " sh version: $BASH_VERSION" >&2
sed --version | head -1
FILE=${1-data1}
echo
echo " Input file:"
nl $FILE
echo
echo " Output"
sed 's/^\(.*====\)\(Document.*\)$/\1\n\2/' $FILE
exit 0
producing:
Code:
% ./s1
sh version: 2.05b.0(1)-release
GNU sed version 4.1.2
Input file:
1 Beginning.
2 This is a test set of data.
3 ==============
4 this is ok.
5 ==============
6 this is ok, too.
7 =============Document
8 this we want changed.
9 =============
10 this is ok again.
11 End
Output
Beginning.
This is a test set of data.
==============
this is ok.
==============
this is ok, too.
=============
Document
this we want changed.
=============
this is ok again.
End
cheers, drl