I'm assuming the horizontal lines aren't actually in the file, and are just used instead of
Code tags are better because they preserve spacing.
Here's a script:
Code:
#!/bin/sh
SHOULDPRINT=1
function do_flush
{
if [[ ${SHOULDPRINT} -eq 1 && ! -z ${OUT} ]]
then
echo "${OUT}"
fi
}
while read LINE
do
if [[ -z ${LINE} ]]
then
do_flush
OUT=""
SHOULDPRINT=1
elif echo "${LINE}" | egrep -q "CONNECT|alter system switch logfile"
then
SHOULDPRINT=0
else
if [[ -z ${OUT} ]]
then
OUT="
${LINE}"
else
OUT="${OUT}
${LINE}"
fi
fi
done
do_flush