Awk: Difference between revisions

From Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 18:27, 4 February 2011

Pick out the fourth token:

mac=`/sbin/arp -a $ip | awk '{print $4}'`

Separate by = instead of whitespace:

echo "a=b=c" | awk -F= '{print $3}'  # selects "c"