Print the number of fields in each line using awk.
example.txt
QUAD 5000009 389633 -62.98719000 4.20363900 -14.08507000 -5.83411800 -2.50325100 -4.89406400 14.13978000 1.43138700 TRIA 5000009 389634 -120.91420000 150.57080000 -76.72402000 0.96178280 -0.36827340 1.96346300 -1.02116100 -41.11020000 QUAD 5000009 389635 -15.21044000 0.99932950 3.18402900 -0.15678900 0.23568760 -0.34962440 0.21704630 -0.38061680 GAP 5000008 344229 -0.00000873 0.00000000 0.00000000 QUAD 5000009 389636 1.33232100 -65.55149000 11.67951000 -0.72253810 -0.16559730 0.68029730 -0.87976630 0.07846473 BUSH 5000008 377944 107.45720000 25.92157000 3.61063300 2.17414500 0.00000000 0.00000000 BUSH 5000008 377945 108.76870000 25.35708000 3.30875900 2.66002100 0.00000000 0.00000000
ex359.txt
awk '{print NF,":",$0}' example.txt
output:
11 : QUAD 5000009 389633 -62.98719000 4.20363900 -14.08507000 -5.83411800 -2.50325100 -4.89406400 14.13978000 1.43138700 11 : TRIA 5000009 389634 -120.91420000 150.57080000 -76.72402000 0.96178280 -0.36827340 1.96346300 -1.02116100 -41.11020000 11 : QUAD 5000009 389635 -15.21044000 0.99932950 3.18402900 -0.15678900 0.23568760 -0.34962440 0.21704630 -0.38061680 6 : GAP 5000008 344229 -0.00000873 0.00000000 0.00000000 11 : QUAD 5000009 389636 1.33232100 -65.55149000 11.67951000 -0.72253810 -0.16559730 0.68029730 -0.87976630 0.07846473 9 : BUSH 5000008 377944 107.45720000 25.92157000 3.61063300 2.17414500 0.00000000 0.00000000 9 : BUSH 5000008 377945 108.76870000 25.35708000 3.30875900 2.66002100 0.00000000 0.00000000
Recent Comments