On 2013-04-06 22:19, Thilo Six wrote: > $ LC_ALL=C ifconfig -a | sed -ne > "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" This one should work for you (if I guess your ifconfig -a output format correctly) -- did you remember to define $re when testing it? re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'