unix sorting

Hi experts,

i have a file.If i will delete some intermediate records from the file then the output file will be in sorted format as show below.

file A

D001 ty gh
D002 fg hi
D003 jk lr
.
.
.
if i will delete the 2nd record then the output file is as follows:

outputfile:

D001 ty gh
D002 jk lr
.
.
.
Thanks in advance
-subhendu-

Hi.

This works for your scenario:

sed 2d file1 | cut -d" " -f2- | awk '{printf( "D%03d %s\n", ++CC, $0 )}'
D001 ty gh
D002 jk lr