I have a csv file, which is comma delimited. It has 300 fields, but not all are populated with data.
What I need to do is run a script that would look at each field and if it is populated then print the contents along with the field number, i.e. Joe Bloggs - 2 (Joe Bloggs is the data and 2 is the field it was in).
I've tried loads of things, but I can't get it right? So a fresh start is probably needed.
This should work. It counts the number of fields and iterates through each one, only printing it if it's not empty.
Actually, to get the exact format you wanted:
Is it possible to print all the populated fields found on each line in one continuous line. Rather then on a new line when one is found, if this makes sense.