weird "cut" in busybox 1.2.2 ?

Steven Shiau steven at nchc.org.tw
Fri Oct 27 09:05:46 UTC 2006


Hi,
Just tested the busybox 1.2.2, but I found it's weird for cut, Here it's
the problem I encountered:
1.  The busybox is 1.2.2, statically link, compiled with gcc (GCC) 3.2.2
20030222 (Red Hat Linux 3.2.2-5)
./busybox --help
BusyBox v1.2.2 (2006.10.26-01:50+0000) multi-call binary

2. I'd like to parse some output of lspci:
[fc6]~/tmp/busybox>lspci -n
00:00.0 0600: 8086:7190 (rev 01)
00:01.0 0604: 8086:7191 (rev 01)
00:07.0 0601: 8086:7110 (rev 08)
00:07.1 0101: 8086:7111 (rev 01)
00:07.2 0c03: 8086:7112
00:07.3 0680: 8086:7113 (rev 08)
00:0f.0 0300: 15ad:0405
00:10.0 0100: 1000:0030 (rev 01)
00:11.0 0200: 1022:2000 (rev 10)
00:12.0 0200: 1022:2000 (rev 10)
00:13.0 0200: 1022:2000 (rev 10)
00:14.0 0401: 1274:1371 (rev 02)
[fc6]~/tmp/busybox>lspci -n | ./busybox cut -d" " -f3
8086:7190
8086:7191
8086:7110
8086:7111
8086:7112
8086:7113
15ad:0405
1000:0030
1022:2000
1022:2000
1022:2000
1274:1371
[fc6]~/tmp/busybox>lspci -n | ./busybox cut -d" " -f3 | ./busybox cut
-d":" -f1-2
Nothing in the screen.

However, if I use the cut in the system (Fedora Core 6 or RedHat 9), the
output is just I want:
[fc6]~/tmp/busybox>lspci -n |  cut -d" " -f3 |  cut -d":" -f1-2
8086:7190
8086:7191
8086:7110
8086:7111
8086:7112
8086:7113
15ad:0405
1000:0030
1022:2000
1022:2000
1022:2000
1274:1371

I tried that in busybox 1.2.1, it works without this problem.
Is this a bug or some new feature I do not notice ?

Thanks in advance.


-- 
Steven Shiau



More information about the busybox mailing list