script:
Code:
> cat conv_form
#! /bin/bash
#conv_form
ifile=file1
ofile=file9
rm $ofile 2>/dev/null
first=0
while read zf
do
fourc=$(echo "$zf" | cut -c1-4)
if [ $fourc -gt 1 ] 2>/dev/null
then
#output prior data (if any) skipping first pass thru file
if [ $first -gt 0 ]
then
echo "$hold_var">>$ofile
echo " ">>$ofile
fi
first=1
#clear variables
hold_var=$(echo "$zf")
else
hold_var=$(echo "$hold_var" "$zf")
fi
done <$ifile
#output prior data (if any) from where fell out of loop
echo "$hold_var">>$ofile
output:
>cat file9
1081 "WPCW 19 - CW/AM1, WPCB 40 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER, " W35AW - Various Shopping Pgms W41CF - TBN W47CV - TBN WLLS-LP 49 - AM1 WATCH WPXI 11 N & WPIX 11 CW
1082 "WPCW 19 - CW/AM1, WTRF-DT2 32 - F/MY, WPCB 40 - FAMN/CORNER, " "WKBS-DT1 46 - FAMN/CORNER, WKBS 47 - FAMN/CORNER, WPCB-DT1 50 - FAMN/CORNER" W45BT - FAMN/CORNER W47CV - TBN WLLS-LP 49 - AM1 WATCH WPXI 11 N & WPIX 11 CW WATCH WPGH 53 F & WWCP 08 F
1086 "WPCW 19 - CW/AM1, WFPT-DT3 28 - V-ME, WTRF-DT2 32 - F/MY, WPCB 40 - FAMN/CORNER," "WKBS-DT1 46 - FAMN/CORNER, WKBS 47 - FAMN/CORNER," "WPCB-DT1 50 - FAMN/CORNER, WGPT-DT3 54 - V-ME" W35AW - Various Shopping Pgms W47CV - TBN WATCH WPXI 11 N & WPIX 11 CW WATCH WPGH 53 F & WWCP 08 F