dcsimg
Linux Today: Linux News On Internet Time.




More on LinuxToday


Proofreading for illusions with grep and AWK

Jun 19, 2016, 18:00 (0 Talkback[s])

AWK reads the text line by line, and the command begins with a pattern-action statement: if the first field (word) equals the variable 'a', AWK does the action in brackets, namely print... But wait! No variable 'a' has been defined yet, so that action can't happen on the first line. AWK moves to the second action, which is to set the variable 'a' equal to the contents of the last field/word ($NF) in the first line, and the variable 'b' to the contents of the whole first line ($0).

Complete Story

Related Stories: