I have a text file whose rows are formatted like this:
BC-2:2009-02-15:Flow:150.00:ft/sec:Temperature (field):7.40:oF:Conductance,
Specific:2058.00:umhos/cm:pH:7.40:Std Units
BC-2:2009-05-15:Flow::ft/sec:Temperature (field):10.10:oF:Conductance,
Specific:1224.00:umhos/cm:pH:8.14:Std Units
On Tue, 22 Mar 2011, Fred James wrote:
Try 'printf' instead of print ...
{printf
%s:%s:%s:%s\n%s:%s:%s:%s:%s\n%s:%s:%s:%s:%s\n%s:%s:%s:%s:%s\n,$1,$2,$3,$4,$5,$1,$2,$6,$7,$8,$1,$2,$9,$10,$11,$1,$2,$12,$13,$14}
... if I haven't miscounted or something, And yes, I treated all values as
Rich Shepard wrote:
On Tue, 22 Mar 2011, Fred James wrote:
Try 'printf' instead of print ...
{printf
%s:%s:%s:%s\n%s:%s:%s:%s:%s\n%s:%s:%s:%s:%s\n%s:%s:%s:%s:%s\n,$1,$2,$3,$4,$5,$1,$2,$6,$7,$8,$1,$2,$9,$10,$11,$1,$2,$12,$13,$14}
... if I haven't miscounted or something, And yes, I
Would this work?
echo BC-2:2009-02-15:Flow:150.00:ft/sec:Temperature
(field):7.40:oF:Conductance,Specific:2058.00:umhos/cm:pH:7.40:Std
Units |
awk -F: '{
print $1:$2:$3:$4:$5 ;
print $1:$2:$6:$7:$8 ;
print $1:$2:$9:$10:$11 ;
print $1:$2:$12:$13:$14 ;
}'
The same in perl:
echo