It seems whenever busybox grep -w finds the pattern as a strict substring of a word but then sees that it's not enclosed by symbols that delimit words, the whole line is discarded. As a result, grep won't find the pattern when it occurs as a word later in the line, and hence won't match the line. Examples: # the good cases that work as expected: echo "a" | busybox grep -w a a echo "b,a" | busybox grep -w a b,a # the bad cases which should match but doesn't: echo "ab,a" | busybox grep -w a <no match> echo "ba,a" | busybox grep -w a <no match> echo "bab,a" | busybox grep -w a <no match> Shouldn't `grep -w ${X}` be equivalent to `grep -e "\<${X}\>"` (the latter works fine in busybox's grep)? At least that seems to be the case in GNU grep, and is explicitly the case in BSD grep according to its manual.
Fixed in git: commit 83e49ade5724f5b3744660e45179461fe2a1b0f8 Author: Denys Vlasenko <vda.linux@googlemail.com> Date: Thu Feb 27 14:56:12 2014 +0100 grep: fix -w match if first match isn't a word, but second is