use arping and awk get target ip mac address

範例指令:利用 ARPING 由網路介面 vmbr0 詢問 192.168.128.190’s MAC , 將結果用 AWK 處理取出第二行第五段的值,並取代該值前後的中括號符號。

sudo arping -I vmbr0 192.168.128.190 -c1|awk -F\  'NR==2 {gsub(/(\[|\])/,null,$5); print $5;}'
00:22:15:13:3F:C1

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s