How to check if the variable value in AWK script is null or empty?

The comparison with "" should have worked, so that’s a bit odd

As one more alternative, you could use the length() function, if zero, your variable is null/empty. E.g.,

if (length(val) == 0)

Also, perhaps the built-in variable NF (number of fields) could come in handy? Since we don’t have access to your input data it’s hard to say though, but another possibility.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)