data shorting many rows into single columns
by Chittu1 from LinuxQuestions.org on (#5E6RP)
Hi, inside the refence.tx file the data arrangement are dived into three sections. Each sections contains many rows. I have to arrange all the rows from from all rows from each section into single colums. . Finally it will be three columns from each three sections. My row data in the txt file like below:
-317 -324 -303 -315 -319 -319 01
-310 -326 -331 -322 -327 -307 02
-330 -316 -317 -323 -318 -321 03
-320 -315 -307 -326 -341 -307 04
-323 -327 -333 -330 -303 -304 05
-308 -322
ABH R N118 18 1 18 6 44 40.744 250.00 737 4
-304 -300 -308 -307 -324 -329 -325
-321 -304 -302 -309 -320 -317 -296
-304 -330 -328 -298 -283 -312 -335
-330 -324 -312 -298 -301 -321 -326
-297 -287 -317 -336 -324 -297 -288
-301 -321
ABH R E118 18 1 18 6 44 40.744 250.00 737 4
79 87 117 103 81 92 97
88 96 103 97 99 105 99
94 98 95 90 89 107 99
65 107 143 87 62 99 112
85 74 97 118 115 95 98
97 81
After shorting it should be like below shown :
-317-30479
-324-30087
-303-308117
-315-307103
-319-32481
-319-32992
-01-32597
-310-32188
-326-30496
-331-302103
-322-30997
-327-32099
-307-317105
-02-29699
-330-30494
-316-33098
-317-32895
-323-29890
-318-28389
-321-312107
-03-33599
-320-33065
-315-324107
-307-312143
-326-29887
-341-30162
-307-32199
-04-326112
-323-29785
-327-28774
-333-31797
-330-336118
-303-324115
-304-29795
-05-28898
-308-30197
-322 -321 81
I can arrange the for single section but, for simultaneously for other two section how it can be done. I am using shell script for single section
for num in $(cat reference.tx)
do
echo $num >>3.txt
done
If any someone can help it will be great help to me. Thank you well in advance.


-317 -324 -303 -315 -319 -319 01
-310 -326 -331 -322 -327 -307 02
-330 -316 -317 -323 -318 -321 03
-320 -315 -307 -326 -341 -307 04
-323 -327 -333 -330 -303 -304 05
-308 -322
ABH R N118 18 1 18 6 44 40.744 250.00 737 4
-304 -300 -308 -307 -324 -329 -325
-321 -304 -302 -309 -320 -317 -296
-304 -330 -328 -298 -283 -312 -335
-330 -324 -312 -298 -301 -321 -326
-297 -287 -317 -336 -324 -297 -288
-301 -321
ABH R E118 18 1 18 6 44 40.744 250.00 737 4
79 87 117 103 81 92 97
88 96 103 97 99 105 99
94 98 95 90 89 107 99
65 107 143 87 62 99 112
85 74 97 118 115 95 98
97 81
After shorting it should be like below shown :
-317-30479
-324-30087
-303-308117
-315-307103
-319-32481
-319-32992
-01-32597
-310-32188
-326-30496
-331-302103
-322-30997
-327-32099
-307-317105
-02-29699
-330-30494
-316-33098
-317-32895
-323-29890
-318-28389
-321-312107
-03-33599
-320-33065
-315-324107
-307-312143
-326-29887
-341-30162
-307-32199
-04-326112
-323-29785
-327-28774
-333-31797
-330-336118
-303-324115
-304-29795
-05-28898
-308-30197
-322 -321 81
I can arrange the for single section but, for simultaneously for other two section how it can be done. I am using shell script for single section
for num in $(cat reference.tx)
do
echo $num >>3.txt
done
If any someone can help it will be great help to me. Thank you well in advance.