awk scripting notes

From thelinuxwiki
Revision as of 23:03, 5 August 2018 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

compound logical statement

$ echo "1 2 3" | awk '{for (i=1; i<=NF; i++) if (($i=="1") && ($(i+1)=="2")) print $(i+2)}'
3