Search for a string in a file and replace

I have file t1.log

Contents of t1.log file
Number of records processed: [0]
Number of records rejected: [100]
Error : [ 1024 : SQL [
xyz ..........
abc ..........
aaa _]
start time : [ ]
end time : [ ]

Please let me know how i can remove the contents highlighted in red in the t1.log file.

Thanks
Sam

Making lots of wild assumptions about what is included in ......... , the following might work:

awk '
dtc {   if($NF ~ /]$/) dtc = 0
        next
}
$NF == "[" {
        dtc++
        $NF = "]"
}
1' t1.log

As always, if you're using a Solaris/SunOS system, use /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk instead of awk .

sed '/Error : \[ 1024 : SQL \[/,/_\]$/c Error : [ 1024 : SQL ]' t1.log
awk 'f{s=1} /Error/{f=1} s!=1{print} /]/{s=0;f=0}' t1.log
Number of records processed: [0]
Number of records rejected: [100]
Error : [ 1024 : SQL [
start time : [ ]
end time : [ ]