Help needed - shell scripting

I have a file that has text in the format below

ABC
/ Some text /
ABC
/ Some text /
ABC
/ Some text /
ABC
/ Some text /
ABC
/ Some text /

How can I seperate the text between a pair of 'ABC' into seperate files ???

any information would be of great help. Thanks

Do you mean you want to create a file that is minus all the ABC's?

grep -v 'ABC' oldfile > newfile

no, if we consider the example ... i want to create five different files with the content of each coming from the text betweeen two consecutive 'ABC's

#/bin/ksh
let filecnt=0
while read record
do
     if [ `echo $record | grep -q '^ABC'` -ne 0 ] ; then
           echo "$record" > newfile"$filecnt"
           let filecnt=$filecnt + 1
     fi
done < oldfile 

Hi,

Out of interest, is possible to redirect the same output with sed to textfile.$count? using branching (b), hold space or whatsoever is available in sed to output different sections from one file to more than files?

Regards,
Tayyab

Thsi is gave an error, something regarding ' unary operators for -ne'

Perhaps use awk...

$ < infile awk '/ABC/{c++; next} {print > "outfile." c}'

$ head outfile.*
==> outfile.1 <==
/ Some text /

==> outfile.2 <==
/ Some text /

==> outfile.3 <==
/ Some text /

==> outfile.4 <==
/ Some text /

==> outfile.5 <==
/ Some text /

Thnks a lot, works gr8. But if i had something in the format

ABC
/unecessary text/
/needed text/
ABC
/unecessary text/
/needed text/
ABC
/unecessary text/
/needed text/

How can I seperate it into files where the 'unecessary text' is removed from each file. so i should have
--------File 1--------
ABC
/needed text/

--------File 2--------
ABC
/needed text/

--------File 3--------
ABC
/needed text/

Thanks.

See the awk manual