sed help needed badly

how can I delete one line above and below the matching pattern ?
e.g I want to delete the line above and below the line with %CLI- in example below :

$CHECKSUM $1$DGA1043:[ORACLE.PATRON]TSTST01.DBF;1
%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF
-RMS-E-FLK, file currently locked by another user

thanks .

This is example to remove 6 line before and after line $rmv_lbl

 # prepare file for testing:
n=0; fl=for_removing_lines.txt; rmv_lbl="point of removing"; rm $fl; 
while [ $n -le 20 ];do  
   (( n++ )); ec "line $n">>$fl; 
   if [ $n -eq 10 ]; then 
      ec $rmv_lbl>>$fl; 
   fi; 
done;

 # geting line numbers to statr and END remuving 
pnt_ln=`nawk -v srch="$rmv_lbl" '{if($0~srch) print NR; }' $fl`; 
((rmv_st=pnt_ln-6)); 
((rmv_end=pnt_ln+6));     ec $pnt_ln, $rmv_st, $rmv_end

 # printing file without 6 lines before and after label line
nawk -v st=$rmv_st -v end=$rmv_end '{if( (NR <= st)||(NR >= end) ) print $0; }' $fl

Im not sure whether its gonna help you or not,
but what popped to my mind:

in case you know which line is :
you can use sed in deleting line

in case you are looking inside a file and you dont know which line its:
you might have to use regular expression like
[^%cli]---> look for everything except %cli

or you can use % as a delimiter in some commands % and make it as a field.

Im not sure wich one might help you,

i hope to be usefull

I only want solution with sed first ..second what I want is follows :

I want these the following three lines

$CHECKSUM $1$DGA1043:[ORACLE.PATRON]TSTST01.DBF;1
%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF
-RMS-E-FLK, file currently locked by another user

reduced to

%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF

using sed ..so how can I do it? I know its possible just dont know the syntax.

forgot to add : yes I know which line Iam looking for .. it is the line starting with %CLI-E
and yes all these lines are in a file.

Hi,

Below command deletes the line with the pattern,along with the next line.

sed '/%CLI-/{N;d;}' input.txt
I want these the following three lines


$CHECKSUM $1$DGA1043:[ORACLE.PATRON]TSTST01.DBF;1
%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF
-RMS-E-FLK, file currently locked by another user

reduced to 

%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF

If my understanding is right,

For the above one, you can use sed or grep to find the line matching the pattern '%CLI-' and redirect it to a temp file.

Regards,
Chella

can u try like this:

sed -n '/^%CLI-E/p' file_name

i got output only the lines starting with %CLI-E :

$ cat del_file
HECKSUM $1$DGA1043:[ORACLE.PATRON]TSTST01.DBF;1
%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF
-RMS-E-FLK, file currently locked by another user
$ sed -n '/^%CLI-E/p' del_file
%CLI-E-OPENIN, error opening $1$DGA1043:[ORACLE]TSTST01.DBF

let me know whether its working or not bcoz am also in learning stage......