Difference between revisions of "awk parsing log fields"
From thelinuxwiki
(Created page with "lets say you need the field after something denoted by a precurser. precurser = rule: example... # echo "1 2 3 4 5 6 rule: 7 8 9 10" | awk '{for (i=1; i<=NF; i++) if ($i==...") |
Latest revision as of 02:34, 6 April 2014
lets say you need the field after something denoted by a precurser.
precurser = rule:
example...
# echo "1 2 3 4 5 6 rule: 7 8 9 10" | awk '{for (i=1; i<=NF; i++) if ($i=="rule:") print $(i+1)}' 7