Comment 0 for bug 274221

Revision history for this message
Rusty Russell (rusty-rustcorp) wrote : grep -w doesn't always grab whole words

Binary package hint: grep

1)
rusty@vivaldi:~$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04

2) rusty@vivaldi:~$ apt-cache policy grep
grep:
  Installed: 2.5.3~dfsg-3
  Candidate: 2.5.3~dfsg-3
  Version table:
 *** 2.5.3~dfsg-3 0
        500 http://au.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

3) Only whole words returned. There were a couple of spurious results in a large grep. Example file (from Linux kernel) is enclosed, and as you can see, piping through same grep expression again "fixes" the problem.

4) rusty@vivaldi:~$ grep -w alloca devel/kernel/linux-2.6/kernel/pid.c
 * Generic pidhash and scalable, time-bounded PID allocator
rusty@vivaldi:~$ grep -w alloca devel/kernel/linux-2.6/kernel/pid.c | grep -w alloca
rusty@vivaldi:~$