Hi,
I have an input file whose this format:
0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000
0.00000E+00 .0000 1.39259E-06 .0643 1.83690E-06 .0547 2.36873E-06 .0488
3.12521E-06 .0427 3.23615E-06 .0419 2.85301E-06 .0448 2.98344E-06 .0423
2.27548E-06 .0498 0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000
.
.
.
I want to print the $1" "$3" "$5" "$7" " of each line and print the results in output file with lines of 158 fields...
I used this commande line:
awk '{printf ($1"\n"$3"\n"$5"\n"$7"\n")}' input | awk 'BEGIN {j=0}{if (NF>0) printf ($1" "); j++;}{if (j>157) {printf ("\n"); j=0}}' > output
It works with this code but I'd like to know if there is another method more easy than this one..
Thanks
I have an input file whose this format:
0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000
0.00000E+00 .0000 1.39259E-06 .0643 1.83690E-06 .0547 2.36873E-06 .0488
3.12521E-06 .0427 3.23615E-06 .0419 2.85301E-06 .0448 2.98344E-06 .0423
2.27548E-06 .0498 0.00000E+00 .0000 0.00000E+00 .0000 0.00000E+00 .0000
.
.
.
I want to print the $1" "$3" "$5" "$7" " of each line and print the results in output file with lines of 158 fields...
I used this commande line:
awk '{printf ($1"\n"$3"\n"$5"\n"$7"\n")}' input | awk 'BEGIN {j=0}{if (NF>0) printf ($1" "); j++;}{if (j>157) {printf ("\n"); j=0}}' > output
It works with this code but I'd like to know if there is another method more easy than this one..
Thanks