I'm having trouble doing something very simple with awk. I'd like to print the last field, followed by another field.
Input file looks like this:
03 Oct 22, Southern ,Mad,WIN,Gro,,33.10
03 Oct 22, Mpd ,Mad,WIN,Auto,-208.56,
23 Sep 22, Thank ,n/a,WIN,,-97.93,
This way round works fine:
$ awk -F',' '{print "first " $6 " and then " $7}' input.csv
first and then 33.10
first -208.56 and then
first -97.93 and then
But when I swap the fields over I get the strangest result:
$ awk -F',' '{print "first " $7 " and then " $6}' input.csv
and then 0
and then -208.56
and then -97.93
I must be missing something really simple. What on earth is going on?
$ awk --version
GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)