The following awk script was written for me to remove records with empty fields in my inputfile. But I have difficulty to understand it. Would you please explain it in details why it is written like that.awk -F, '{for(i=1;i<=NF;i++)if($i==){next}}1' inputfile
Can someone please explain the meaning of the following awk script?
awk
Let's break it up into components:awk                    # The actual program-F,                    # Set the field delimiter to a comma'{                     # Beginning of the main series of action statementsfor(i=1;i<=NF;i++)     # Your typical for loop.   NF is the number of fields                        # in the input  if($i==){          # $i will expand to e. g. $1, then $2, etc.,  which                        # is each field in the input data                       # If it is  (or an empty string):     next}             # Skip to the next entry.  End of conditional                       # and of the foor loop (no braces here)}                      # End of the main series of action statements1'                     # awkish shorthand basically for `print`, and end of                       # the scriptinputfile              # The file to be processedSince awk's default action is to include data, the script simply skips records with any empty data fields, and prints everything not skipped.