Bug 12226

Summary: sed captures more characters than intended
Product: Busybox Reporter: yogo.1212
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.31.x   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Host: Target:
Build:
Attachments: requested config file

Description yogo.1212 2019-09-17 16:21:32 UTC
Created attachment 8251 [details]
requested config file

Hi.
I'm using Busybox with OpenWRT.
This error was present since at least may this year, likely earlier.

$ echo "8.8.8.8 via 192.168.0.1 dev br-private src 192.168.0.32 uid 0"| sed -nE 's/^.*dev\s*([^\s]*)*.*$/\1/p'
 br-private

The problem is the blank before the interface name.

With GNU sed, the line functions correctly.

warm wishes
Comment 1 Leon George 2019-12-28 13:22:17 UTC
Oops. Forgot i did this..
Here's another:

ip rule list | sed -nE 's/^.*iif\s*([^\s]*).*lookup\s*2.*$/\1/p' | grep '\-n_' | hexdump -C
00000000  62 72 2d 6e 5f 37 33 34  20 0a                    |br-n_734 .|
0000000a

echo '2:      from all iif br-n_734 lookup 2' | sed -nE 's/^.*iif\s*([^\s]*).*lookup\s*2.*$/\1/p' | grep '\-n_'

this time it spits out a space at the end.