busybox sed captures space from expression with ^\s
yogo1212 opened this issue · comments
Leon Busch-George commented
echo '8.8.8.8 via 192.168.0.1 dev br-n_1 src 192.168.0.37 uid 0 cache ' | sed -nE 's/^.*dev\s*([^\s]*).*$/\1/p' | hexdump -C
00000000 62 72 2d 6e 5f 31 20 0a |br-n_1 .|
00000008
Changing the capture to ([^ \s]*)
removes the space from the output.
This is with Busybox 1.36.0 from Openwrt.