Bug 12226 - sed captures more characters than intended
Summary: sed captures more characters than intended
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.31.x
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-17 16:21 UTC by yogo.1212
Modified: 2019-12-28 13:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
requested config file (33.78 KB, application/octet-stream)
2019-09-17 16:21 UTC, yogo.1212
Details

Note You need to log in before you can comment on or make changes to this bug.
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.