Quick and easy in sed would be
sed '
/^\]/{
$!N
/\n?please~0.001)/{
$!N
/.*\n(\[/s/.*//
}
}' < input
and harder in awk
awk 'BEGIN{
L1="]"
L2="?please~0.001)"
L3="(["
}
{
a[0]=a[1]; a[1]=a[2]; a[2]=$0
if( $1 == L3 && a[0] == L1 && a[1] == L2 )
printf("\n"

else if( $1 != L1 && $1 != L2 && $1 != L3 ){
if( a[0] == L1 && a[1] == L2 )
printf("%s\n%s\n%s\n",a[0],a[1], $0)
else if( a[1] == L1 )
printf("%s\n%s\n",a[1], $0)
else
print
}
}
END{
if( a[2] == L1 ) printf("%s\n", a[2])
else if( a[1] == L1 && a[2]==L2 ) printf("%s\n%s\n", a[1],a[2])
}' < input
The awk example is harder because I assume to keep these strings when they are out of order/sequence in instances of lines fewer then 3 and at the end of the file - common sources of error in awk scripts. Similar is the $!N in the sed script. Cheers,
ND
bigoldbulldog@hotmail.com