I am trying to get ether mac address it is in the second column

Viewed 17
ifconfig | grep ether | cut -d " " -f 10

This is how I am trying to get the ether but I am on this for about 2 hours trying to understand why I am selecting 10th column to cut out when ether is on 2nd column.

I'm just trying to understand

enter image description here

1 Answers

Try

ifconfig | grep ether | sed 's/^[[:space:]]*//g' | cut -d " " -f 2

This will remove leading whitespace as per this SO-link and then you can use a single space as delimiter.

Related