Is it a fake website?

Mostrando entradas con la etiqueta grep. Mostrar todas las entradas
Mostrando entradas con la etiqueta grep. Mostrar todas las entradas

15 enero 2007

Grep utility question

Tenemos un archivo llamado nombres.txt con las siguientes entradas:

aperez.2
aperez_
apepito

Queremos realizar una búsqueda exacta de aperez, que no tendrá que aparecer en este archivo.
Pero voilá;

[root@server tmp]# grep -w aperez nombres.txt
aperez.2

¿Porqué aparece?

El man del grep dice:
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.

¿Cómo evitar que aparezca?