Given the following file:
>tna
ATGC
>ggf
TG
>gta
TGGTT
I want to find the longest line that does not start with >. I've figured out the AWK code:
awk '!/>/ {len=length($0)} len > maximum {maximum=len} END{print maximum}' file
I cannot explain, however, how maximum is used before being defined. First, I make the comparison to len and then I set maximum to len. How does AWK know what maximum is?
Thanks!