On 1 Oct 1999, Ben Pfaff wrote: > Dale Scheetz <[EMAIL PROTECTED]> writes: > > > $ grep -w debhelper override.potato > > debhelper optional devel > > hello-debhelper optional devel > > > > In the man page, under the -w option, it says that, in order to match, the > > string must be either at the beginning of the line, or preceeded by a > > non-word contituent character, which it declares as letters, digits, and > > the underscore. > > No, it says that those are word constituent characters.
That's what I meant... > > > The hyphon at the ned of hello in "hello-debhelper" isn't any of these, > > but grep declares it to match anyway! Is this something to do with the > > form of my expression? > > It's preceded by a character that isn't a letter, digit or underscore: > a hyphen. > Which confused me as to why it was being included in the "word". So a "search string" is defined as any characters delimited by blank, tab, or newline, but because the hyphon is not considered a "word constituent" character, debhelper is considered a "whole word" within the string "hello-debhelper"? While this seems to be working with two definitions of what is a word (the parser considers hello-debhelper as "one word" while the expression analysis considers it two words), I can accept that this is the true state of affairs. This leaves me with the unresolved problem of distinguishing between the two package names. I just read through the grep manpage (again) looking for something that will enforce an exact match, when I realised that I can simply skip this step and do the selection in awk (which I was using before to peel off the section name from the grep output), so the right command is: awk -v name=debhelper ' name == $1 { print $3 } ' override.potato which produced the single line: devel rather than: grep -w debhelper override.potato |awk '{ print $3 }' which produced the two line ouput: devel devel Thanks for the education, problem-set can be a real killer. Luck, Dwarf -- _-_-_-_-_- Author of "The Debian Linux User's Guide" _-_-_-_-_-_- aka Dale Scheetz Phone: 1 (850) 656-9769 Flexible Software 11000 McCrackin Road e-mail: [EMAIL PROTECTED] Tallahassee, FL 32308 _-_-_-_-_-_- See www.linuxpress.com for more details _-_-_-_-_-_-_-