I have a file with 10 fields and every 4th row has 4 fields. I want to multiply this matrix file with a value of 0.08333.
When I multiply the full matrix using the command:
{print ($1*0.08333,$2*0.08333,$3*0.08333,$4*0.08333,$5*0.08333,$6*0.08333,$7*0.08333,$8*0.08333,$9*0.08333,$10*0.08333 ) } it multiples, however it adds 6 more fields in the 4th row with zeros.
I then tried to remove the 6 fields from the 4th, 8th, 12th, etc rows by using the command:
NR==4{print ($1,$2,$3,$4,$5=$6=$7=$8=$9=$10=””)}
NR==8{print ($1,$2,$3,$4,$5=$6=$7=$8=$9=$10=””)}
NR= {print ($1,$2,$3,$4,$5=$6=$7=$8=$9=$10=””)}
(NR==1),/stop/{print}
what this does, is removes the fields from the 4th, 8th, and 12th rows and keeps the first four fields in these rows. However, it adds extra one row with the same four fields below. My matrix is 447 MB and it is tedious to go and delete those rows manually.
Could you please help me as how to write the script or modify the above scripts.
Attached is an example data set.
Thank you so much.
Example data set:
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768
0.0468 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768 0.0768
0.0668 0.0768 0.0768 0.0768