eg: sample.dat
21111111110000652 B86860003OLFXXX0000001_20081227
21111111110000652 B86860003ODL-SP0000002_20081227
21111111110000652-B94030001ODL-CH0000003_20081227
22222222220000653-B94030001OLFXXX0000011_20081227
23333333330000654-E71060001OLFXXX0000012_20081227
24444444440000655 E71060002OLFXXX0000014_20081227
24444444440000655 E71060002ODL-SP0000015_20081227
.....
.....
I Want to write a program in ksh script in such a way (while read line do) that the out txt file should look like below
outfile.txt
21111111110000652 B86860003OLFXXX000000120081227 0000002 0000003
22222222220000653-B94030001OLFXXX000001120081227
23333333330000654-E71060001OLFXXX000001220081227
24444444440000655 E71060002OLFXXX000001420081227 0000015
thx