Provided by: manpages-es_4.21.0-2_all 

NOMBRE
grep, egrep, fgrep - rgrep - muestran líneas que concuerdan con un patrón
SINOPSIS
grep [OPCIÓN...] PATRONES [ARCHIVO...]
grep [OPCIÓN...] -e PATRONES ... [ARCHIVO...]
grep [OPCIÓN...] -f ARCHIVO_PATRÓN ... [ARCHIVO...]
DESCRIPCIÓN
grep busca PATRONES en cada ARCHIVO. PATRONES consistirá en uno o más patrones separados entre sí por un
salto de línea; grep mostrará cada línea donde encuentre una concordancia con dicho patrón. En general,
deben entrecomillarse los patrones si se ejecut grep dentro de otra orden de la shell.
Si definimos ARCHIVO como '-', se considerará la entrada estándar. Si nose define ningún valor para
ARCHIVO, se hará una búsqueda recursiva del directorio actual y no recursiva de la entrada estándar.
Debian also includes the variant programs egrep, fgrep and rgrep. These programs are the same as
grep -E, grep -F, and grep -r, respectively. These variants are deprecated upstream, but Debian provides
for backward compatibility. For portability reasons, it is recommended to avoid the variant programs, and
use grep with the related option instead.
OPCIONES
Información genérica de la aplicación
--help Muestra una breve instrucción de uso y finaliza.
-V, --version
Muestra la versión de grep y termina.
Sintaxis del patrón
-E, --extended-regexp
Interpreta PATRONES como una expresión regular extendida (vea más adelante).
-F, --fixed-strings
Interpreta PATRONES como una cadena de texto, no como expresiones regulares.
-G, --basic-regexp
Interpreta PATRONES como una expresión regular básica (vea más abajo). Éste es el comportamiento
predeterminado.
-P, --perl-regexp
Interpreta PATRONES como un expresión regular de Perl (PCRE). Esta opción aún es experimental si
se combina con -z (--vacío), grep -P puede emitir avisos acerca de funciones no implementadas.
Gestión de las concordancias
-e PATRONES, --regexp=PATRONES
Emplea PATRONES como patrones. Si se usa varias veces o se combina con la opción -f (--file) la
búsqueda se realizará con todos los patrones dado. Esta opción es útil para proteger un patrón que
comience por '-'.
-f ARCHIVO, --file=ARCHIVO
Obtain patterns from FILE, one per line. If this option is used multiple times or is combined
with the -e (--regexp) option, search for all patterns given. The empty file contains zero
patterns, and therefore matches nothing. If FILE is - , read patterns from standard input.
-i, --ignore-case
No distingue entre mayúsculas y minúsculas tanto en los patrones como en los datos de entrada, así
que los caracteres que sólo difieran en este aspecto resultarán en una coincidencia.
--no-ignore-case
Distingue entre mayúsculas y minúsculas tanto en los patrones como en los datos de entrada
(comportamiento por defecto). Esta opción es útil en el caso de emplearse en scripts de shell
donde se haya definido previamente la opción -i ya que ambas opciones se anulan entre sí.
-v, --invert-match
Invierte el sentido de la concordancia, seleccionando las líneas que no concuerden.
-w, --word-regexp
Selecciona solamente aquellas líneas que contienen concordancias que forman palabras completas. La
comprobación consiste en que la cadena de caracteres concordante debe estar al principio de la
línea o precedida por un carácter que no forme parte de una palabra. De forma similar, debe estar
o al final de la línea o ser seguida por un carácter no constituyente de palabra. Los caracteres
que se consideran como parte de palabras son letras, dígitos y el subrayado. No tiene efecto si
también de define la opción -x.
-x, --line-regexp
Selecciona únicamente las línea que concuerden completa y exactamente en su totalidad con el
patrón. Equivaldría, en el caso de una expresión regular, a definir el patrón entre paréntesis
comenzando con ^ y finalizando con $.
Gestión general de la salida
-c, --count
Suprime la salida normal; en su lugar muestra el número de líneas que concuerdan con el patrón
para cada archivo de entrada. Con la opción -v, --invert-match, contabiliza el número de líneas
que no concuerdan.
--color[=CUANDO], --colour[=CUANDO]
Rodea las cadenas concordantes (que no estén en blanco), líneas concordantes, nombres de archivo,
números de línea, bytes de compensación y separadores (para los campos y grupos de líneas
contextuales) con secuencias de escape para mostrarlas en distintos colores a través del terminal.
Dichos colores se definen a través de la variable de entorno GREP_COLORS. Los colores se definen
mediante las variables de entorno . CUANDO puede tener tres valores diferentes: never (nunca),
always (siempre) o auto.
-L, --files-without-match
Suprime la salida normal; en su lugar muestra el nombre de cada archivo de entrada donde no se
encuentre ninguna concordancia y por lo tanto de cada fichero que no produciría ninguna salida.
-l, --files-with-matches
Suprime la salida normal; en su lugar muestra el nombre de cada fichero de entrada que produciría
alguna salida. La búsqueda de cada entrada se detendrá en la primera concordancia.
-m NÚM, --max-count=NÚM
Stop reading a file after NUM matching lines. If NUM is zero, grep stops right away without
reading input. A NUM of -1 is treated as infinity and grep does not stop; this is the default.
If the input is standard input from a regular file, and NUM matching lines are output, grep
ensures that the standard input is positioned to just after the last matching line before exiting,
regardless of the presence of trailing context lines. This enables a calling process to resume a
search. When grep stops after NUM matching lines, it outputs any trailing context lines. When
the -c or --count option is also used, grep does not output a count greater than NUM. When the -v
or --invert-match option is also used, grep stops after outputting NUM non-matching lines.
-o, --only-matching
Muestra sólo la parte coincidente con el patrón de una línea concordante, siempre que no sea una
cadena vacía y poniendo cada parte en una línea diferente.
-q, --quiet, --silent
Mínima salida. No muestra nada en la salida estándar. Termina con estado cero si encuentra alguna
concordancia aunque detecte algún error. Consulte también la opción -s o --no-messages.
-s, --no-messages
Suprime los mensajes de error sobre archivos que no existen o no se pueden leer.
Muestra un prefijo de control en cada línea
-b, --byte-offset
Muestra el desplazamiento de bytes, comenzando en cero, dentro del archivo de entrada antes de
cada línea mostrada. Si se define -o (-only-matching), muestra el desplazamiento de la parte
concordante.
-H, --with-filename
Muestra el nombre del archivo donde se produjo la concordancia. Esto se hará por defecto cuando se
busque en más de un archivo. Es una extensión de GNU.
-h, --no-filename
No muestra los nombres de archivo antes de cada línea. Es el comportamiento por defecto cuando se
realiza la búsqueda en un solo archivo o en la entrada estandar.
--label=ETIQUETA
Muestra la entrada provienente de la entrada estándar como entrada proveniente del archivo LABEL.
Esto puede ser útil para las órdenes que transforman el contenido de un archivo antes de realizar
la búsqueda. Por ejemplo: gzip -cd foo.gz | grep --label=foo -H 'algún patrón'. Consulte también
la opción -H.
-n, --line-number
Antepone a cada línea mostrada el número de línea de su archivo de entrada correspondiente
comenzando por el 1.
-T, --initial-tab
Se asegura que el primer carácter de la línea actual esté en una tabulación, de modo que la
alíneación de las tabulaciones parezca normal. Esto es útil con las opciones que anteponen su
salida al contenido real: -H, -n y -b. Para incrementar la probabilidad de que todas las líneas de
un mismo archivo comiencen en la misma columna, también hace que el número de línea y el
desplazamiento de bytes (si existe) se impriman en un ancho de campo mínimo.
-Z, --null
Muestra un byte cero (el carácter ASCII NUL) en lugar del carácter que habitualmente seguiría al
nombre de un archivo. Por ejemplo: grep -lZ genera un byte cero después de cada nombre de archivo
en lugar del salto de línea habitual. Esta opción hace que la salida no sea ambigua, incluso con
nombres de archivo que contengan caracteres poco usuales como saltos de línea. Esta opción se
puede usar con órdenes como find -print0, perl -0, sort -z y xargs -0 para procesar nombres de
archivos arbitrarios, incluso aquellos que contienen saltos de línea en su nombre.
Gestión de Líneas Contextuales
-A NÚM, --after-context=NÚM
Imprime NUM líneas de contexto posterior después de las líneas concordantes. Coloca una línea que
contiene un separador de grupo (--) entre grupos contiguos de coincordancias. Con la opción -o o
--only-matching, se emitirá un mensaje de advertencia y no tendrá ningún efecto.
-B NÚM, --before-context=NÚM
Imprime NUM cantidad de líneas de contexto respecto de la concordante. Añade un separador (--)
entre grupos de concordancias. Si se emplea con la opción -o o --only-matching, no tendrá ningún
efecto y se emitirá un aviso.
-C NÚM, -NÚM, --context=NÚM
Muestra NUM líneas contextuales. Inserta una línea con un separador (--) entre grupos contiguos de
concordancias. Si se usa la opción -o o --only-matching, se emite un mensaje de advertencia y no
tendrá ningún efecto.
--group-separator=SEP
Cuando se usen las opciones -A, -B o -C, emplea SEP en lugar de -- entre los distintos grupos de
líneas.
--no-group-separator
Cuando se usen las opciones -A, -B o -C, no me mostrará ningún separador entre líneas.
Selección de archivos y directorios
-a, --text
Procesa un archivo binario como si se tratase de texto. Equivale a la opción --binary-files=text.
--binary-files=TIPO
Si los datos o metadatos de un archivo indican que su contenido es binario, asume que dicho
archivo es del tipo TIPO. Los bytes que no codifican texto, indican que el contenido es binario;
estos podrán ser bytes incorrectamente codificados para la localización en uso o bytes nulos si no
se indicó la opción -z.
Por defecto, TIPO se considera binary, con lo cual grep elimina cualquier salida si se encuentra
con datos binarios o datos incorrectamente codificados. Cada vez que se elimina algo en la salida,
grep mostrará un mensaje en la salida de error estándar informando de la concordancia con un
archivo binario.
Si TIPO es without-match, grep asumirá que no hay concordancia alguna en el resto del archivo si
se encuentra contenido nulo binarios. Esto equivale a la opción -I.
Si TIPO es texto, grep procesará un archivo binario como si se tratase de texto. Equivale a la
opción -a.
When type is binary, grep may treat non-text bytes as line terminators even without the -z option.
This means choosing binary versus text can affect whether a pattern matches a file. For example,
when type is binary the pattern q$ might match q immediately followed by a null byte, even though
this is not matched when type is text. Conversely, when type is binary the pattern . (period)
might not match a null byte.
Warning: The -a option might output binary garbage, which can have nasty side effects if the
output is a terminal and if the terminal driver interprets some of it as commands. On the other
hand, when reading files whose text encodings are unknown, it can be helpful to use -a or to set
LC_ALL='C' in the environment, in order to find more matches even if the matches are unsafe for
direct display.
-D ACCIÓN, --devices=ACCIÓN
If an input file is a device, FIFO or socket, use ACTION to process it. By default, ACTION is
read, which means that devices are read just as if they were ordinary files. If ACTION is skip,
devices are silently skipped.
-d ACCIÓN, --directories=ACCIÓN
Emplea ACCIÓN para procesar el archivo de entrada si éste es un directorio. Por defecto, esta
ACCIÓN es read (leer), esto es que leerá directorios tal como si fuesen archivos. Si ACCIÓN es
skip, se saltará los directorios sin emitir ningún mensaje. Por último, si ACCIÓN es recurse,
leerá de forma recusiva todos los archivos que se encuentren dentro de cada directorio siguiendo
los enlaces simbólicos sólo si se indican en la línea de órdenes. Esto equivaldría a definir la
opción -r.
--exclude=GLOB
Skip any command-line file with a name suffix that matches the pattern GLOB, using wildcard
matching; a name suffix is either the whole name, or a trailing part that starts with a non-slash
character immediately after a slash (/) in the name. When searching recursively, skip any
subfile whose base name matches GLOB; the base name is the part after the last slash. A pattern
can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally.
--exclude-from=ARCHIVO
Ignora archivos cuya base del nombre coincida con alguna de las expresiones contenidas en ARCHIVO
(empleando concordancias tal como se describió en --exclude).
--exclude-dir=GLOB
Skip any command-line directory with a name suffix that matches the pattern GLOB. When searching
recursively, skip any subdirectory whose base name matches GLOB. Ignore any redundant trailing
slashes in GLOB.
-I Procesa un archivo binario como si no contuviese ninguna concordancia. Equivale a la opción
--binary-files=without-match.
--include=GLOB
Search only files whose base name matches GLOB (using wildcard matching as described under
--exclude). If contradictory --include and --exclude options are given, the last matching one
wins. If no --include or --exclude options match, a file is included unless the first such option
is --include.
-r, --recursive
Read all files under each directory, recursively, following symbolic links only if they are on the
command line. Note that if no file operand is given, grep searches the working directory. This
is equivalent to the -d recurse option.
-R, --dereference-recursive
Lee recursivamente todos los archivos dentro de cada directorio. Sigue todos los enlaces
simbólicos a diferencia de -r.
Otras opciones
--line-buffered
Emplea el bufer de línea para la salida. Puede provocar un descenso del rendimiento.
-U, --binary
Treat the file(s) as binary. By default, under MS-DOS and MS-Windows, grep guesses whether a file
is text or binary as described for the --binary-files option. If grep decides the file is a text
file, it strips the CR characters from the original file contents (to make regular expressions
with ^ and $ work correctly). Specifying -U overrules this guesswork, causing all files to be
read and passed to the matching mechanism verbatim; if the file is a text file with CR/LF pairs at
the end of each line, this will cause some regular expressions to fail. This option has no effect
on platforms other than MS-DOS and MS-Windows.
-z, --null-data
Treat input and output data as sequences of lines, each terminated by a zero byte (the ASCII NUL
character) instead of a newline. Like the -Z or --null option, this option can be used with
commands like sort -z to process arbitrary file names.
EXPRESIONES REGULARES
Una expresión regular es un patrón que describe un conjunto de cadenas de caracteres. Las expresiones
regulares se construyen de forma análoga a las expresiones aritméticas, combinando expresiones más
pequeñas mediante ciertos operadores para formar expresiones complejas.
grep understands three different versions of regular expression syntax: “basic” (BRE), “extended” (ERE)
and “perl” (PCRE). In GNU grep, basic and extended regular expressions are merely different notations
for the same pattern-matching functionality. In other implementations, basic regular expressions are
ordinarily less powerful than extended, though occasionally it is the other way around. The following
description applies to extended regular expressions; differences for basic regular expressions are
summarized afterwards. Perl-compatible regular expressions have different functionality, and are
documented in pcre2syntax(3) and pcre2pattern(3), but work only if PCRE support is enabled.
Los bloques de construcción fundamentales son las expresiones regulares que concuerdan con un solo
carácter. La mayoría de los caracteres, incluyendo todas las letras y dígitos, son expresiones regulares
que concuerdan consigo mismos. Cualquier meta-carácter con un significado especial debe ser protegido
precediéndolo con una barra inclinada inversa.
El punto . concuerda con un único carácter, cualquiera que sea. No está definido el comportamiento si se
topa con un error de codificación.
Grupos de caracters y Expresiones entre Corchetes
A bracket expression is a list of characters enclosed by [ and ]. It matches any single character in
that list. If the first character of the list is the caret ^ then it matches any character not in the
list; it is unspecified whether it matches an encoding error. For example, the regular expression
[0123456789] matches any single digit.
Within a bracket expression, a range expression consists of two characters separated by a hyphen. It
matches any single character that sorts between the two characters, inclusive, using the locale's
collating sequence and character set. For example, in the default C locale, [a-d] is equivalent to
[abcd]. Many locales sort characters in dictionary order, and in these locales [a-d] is typically not
equivalent to [abcd]; it might be equivalent to [aBbCcDd], for example. To obtain the traditional
interpretation of bracket expressions, you can use the C locale by setting the LC_ALL environment
variable to the value C.
Finally, certain named classes of characters are predefined within bracket expressions, as follows.
Their names are self explanatory, and they are [:alnum:], [:alpha:], [:blank:], [:cntrl:], [:digit:],
[:graph:], [:lower:], [:print:], [:punct:], [:space:], [:upper:], and [:xdigit:]. For example,
[[:alnum:]] means the character class of numbers and letters in the current locale. In the C locale and
ASCII character set encoding, this is the same as [0-9A-Za-z]. (Note that the brackets in these class
names are part of the symbolic names, and must be included in addition to the brackets delimiting the
bracket expression.) Most meta-characters lose their special meaning inside bracket expressions. To
include a literal ] place it first in the list. Similarly, to include a literal ^ place it anywhere but
first. Finally, to include a literal - place it last.
Anclado
El símbolo de intercalación (caret en inglés) ^ y el dólar $ son metacaracteres que concuerdan
respectivamente con una cadena vacía al inicio y al final de una línea.
La Barra Invertida y otras Expresiones Especiales
Los símbolos \< y \> concuerdan con una cadena vacía al inicio y al fina de una palabra, respetivamente.
El símbolo \b concuerda con una cadena vacía en los extremos de una palabra y 0hará lo propio si dicha
cadena vacío NO está en los extremos de una palabra. El símbolo \w es sinómino de [_[:alnum:]] y \W lo es
de [^_[:alnum:]].
Repetición
Una expresión regular que concuerde con un solo carácter puede ser seguida por uno de estos varios
operadores de repetición:
? El elemento precedente es opcional y concuerda como mucho una vez.
* El elemento precedente concordará cero o más veces.
+ El elemento precedente concordará una o más veces.
{n} El elemento precedente concuerda exactamente n veces.
{n,} El elemento precedente concuerda n o más veces.
{,m} El elemento precedente concuerda un máximo de m veces. Es una extensión de GNU.
{n,m} El elemento precedente concuerda como poco n veces, pero no más de m veces.
Concatenación
Dos expresiones regulares pueden concatenarse; la expresión regular resultante concuerda con cualquier
cadena formada mediante la concatenación de dos subcadenas que concuerdan respectivamente con las
expresiones concatenadas.
Alternancia
Dos expresiones regulares pueden juntarse mediante el operador |; la expresión regular resultante
concuerda con cualquier cadena que concuerde con cualquiera de las expresiones.
Precedencia
La repetición tiene precedencia sobre la concatenación, la cual a su vez tiene precedencia sobre la
alternancia. Una expresión entera puede ser encerrada entre paréntesis para subvertir estas reglas de
precedencia.
Retroreferencias y Subexpresiones
La retrorreferencia \n, donde n es un dígito simple, concuerda con la subcadena que previamente concordó
con la n-sima subexpresión entre paréntesis de la expresión regular.
Expresiones Regulares Básicas y Ampliadas
En las expresiones regulares básicas, los metacaracteres ?, +, {, |, (, y ) pierden su significado
especial; en su lugar emplee las versiones protegidas mediante la barra inversa \?, \+, \{, \|, \(, y \).
ESTADO DE SALIDA
El estado de salida suele ser 0 si se ha seleccinado alguna línea, 1 si no se ha seleccionado ninguna y 2
si ha ocurrido algún error. Sin embargo, si se indicó la opción -q o --quiet o --silent el estado de
salida será cero aunque ocurriese algún error.
ENTORNO
El comportamiento de grep está influido por las siguientes variables de entorno.
The locale for category LC_foo is specified by examining the three environment variables LC_ALL, LC_foo,
LANG, in that order. The first of these variables that is set specifies the locale. For example, if
LC_ALL is not set, but LC_MESSAGES is set to pt_BR, then the Brazilian Portuguese locale is used for the
LC_MESSAGES category. The C locale is used if none of these environment variables are set, if the locale
catalog is not installed, or if grep was not compiled with national language support (NLS). The shell
command locale -a lists locales that are currently available.
GREP_COLORS
Controls how the --color option highlights output. Its value is a colon-separated list of
capabilities that defaults to ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36 with the rv and ne
boolean capabilities omitted (i.e., false). Supported capabilities are as follows.
sl= SGR substring for whole selected lines (i.e., matching lines when the -v command-line
option is omitted, or non-matching lines when -v is specified). If however the boolean rv
capability and the -v command-line option are both specified, it applies to context
matching lines instead. The default is empty (i.e., the terminal's default color pair).
cx= SGR substring for whole context lines (i.e., non-matching lines when the -v command-line
option is omitted, or matching lines when -v is specified). If however the boolean rv
capability and the -v command-line option are both specified, it applies to selected
non-matching lines instead. The default is empty (i.e., the terminal's default color
pair).
rv Valor booleano que invierte el significado de las capacidades sl= y cx=cuando se define la
opción -v. Por defecto es falso, es decir que se omite la capacidad.
mt=01;31
SGR substring for matching non-empty text in any matching line (i.e., a selected line when
the -v command-line option is omitted, or a context line when -v is specified). Setting
this is equivalent to setting both ms= and mc= at once to the same value. The default is a
bold red text foreground over the current line background.
ms=01;31
SGR substring for matching non-empty text in a selected line. (This is only used when the
-v command-line option is omitted.) The effect of the sl= (or cx= if rv) capability
remains active when this kicks in. The default is a bold red text foreground over the
current line background.
mc=01;31
SGR substring for matching non-empty text in a context line. (This is only used when the
-v command-line option is specified.) The effect of the cx= (or sl= if rv) capability
remains active when this kicks in. The default is a bold red text foreground over the
current line background.
fn=35 SGR substring for file names prefixing any content line. The default is a magenta text
foreground over the terminal's default background.
ln=32 SGR substring for line numbers prefixing any content line. The default is a green text
foreground over the terminal's default background.
bn=32 SGR substring for byte offsets prefixing any content line. The default is a green text
foreground over the terminal's default background.
se=36 SGR substring for separators that are inserted between selected line fields (:), between
context line fields, (-), and between groups of adjacent lines when nonzero context is
specified (--). The default is a cyan text foreground over the terminal's default
background.
ne Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right
(\33[K) each time a colorized item ends. This is needed on terminals on which EL is not
supported. It is otherwise useful on terminals for which the back_color_erase (bce)
boolean terminfo capability does not apply, when the chosen highlight colors do not affect
the background, or when EL is too slow or causes too much flicker. The default is false
(i.e., the capability is omitted).
Note that boolean capabilities have no =... part. They are omitted (i.e., false) by default and
become true when specified.
See the Select Graphic Rendition (SGR) section in the documentation of the text terminal that is
used for permitted values and their meaning as character attributes. These substring values are
integers in decimal representation and can be concatenated with semicolons. grep takes care of
assembling the result into a complete SGR sequence (\33[...m). Common values to concatenate
include 1 for bold, 4 for underline, 5 for blink, 7 for inverse, 39 for default foreground color,
30 to 37 for foreground colors, 90 to 97 for 16-color mode foreground colors, 38;5;0 to 38;5;255
for 88-color and 256-color modes foreground colors, 49 for default background color, 40 to 47 for
background colors, 100 to 107 for 16-color mode background colors, and 48;5;0 to 48;5;255 for
88-color and 256-color modes background colors.
LC_ALL, LC_COLLATE, LANG
These variables specify the locale for the LC_COLLATE category, which determines the collating
sequence used to interpret range expressions like [a-z].
LC_ALL, LC_CTYPE, LANG
These variables specify the locale for the LC_CTYPE category, which determines the type of
characters, e.g., which characters are whitespace. This category also determines the character
encoding, that is, whether text is encoded in UTF-8, ASCII, or some other encoding. In the C or
POSIX locale, all characters are encoded as a single byte and every byte is a valid character.
LC_ALL, LC_MESSAGES, LANG
These variables specify the locale for the LC_MESSAGES category, which determines the language
that grep uses for messages. The default C locale uses American English messages.
POSIXLY_CORRECT
If set, grep behaves as POSIX requires; otherwise, grep behaves more like other GNU programs.
POSIX requires that options that follow file names must be treated as file names; by default, such
options are permuted to the front of the operand list and are treated as options. Also, POSIX
requires that unrecognized options be diagnosed as “illegal”, but since they are not really
against the law the default is to diagnose them as “invalid”.
NOTAS
Esta página de manual no se mantienede forma rigurosa. La documentación completa suele estar más
actualizada.
COPYRIGHT
Copyright 1998-2000, 2002, 2005-2023 Free Software Foundation, Inc.
Esto es software libre; consulte el código fuente para concoer las condiciones de distribución. NO existe
garantía alguna; ni siquiera acerca de la COMERCIALIZACIÓN o la IDONEIDAD DE SU USO PARA UN FIN CONCRETO.
ERRORES
Informar de Errores
Email bug reports to the bug-reporting address ⟨bug-grep@gnu.org⟩. An email archive
⟨https://lists.gnu.org/mailman/listinfo/bug-grep⟩ and a bug tracker
⟨https://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep⟩ are available.
Errores Conocidos
Números de repetición grandes en la construcción {n,m} pueden hacer que grep emplee grandes cantidades de
memoria. En adición a esto, ciertas otras obscuras expresiones regulares requieren tiempo y espacio
exponenciales, y pueden hacer que grep se quede sin memoria.
Las retrorreferencias son muy lentas, y pueden requerir un tiempo exponencial.
EJEMPLO
The following example outputs the location and contents of any line containing “f” and ending in “.c”,
within all files in the current directory whose names contain “g” and end in “.h”. The -n option outputs
line numbers, the -- argument treats expansions of “*g*.h” starting with “-” as file names not options,
and the empty file /dev/null causes file names to be output even if only one file name happens to be of
the form “*g*.h”.
$ grep -n -- 'f.*\.c$' *g*.h /dev/null
argmatch.h:1:/* definiciones y prototipos para argmatch.c
The only line that matches is line 1 of argmatch.h. Note that the regular expression syntax used in the
pattern differs from the globbing syntax that the shell uses to match file names.
VÉASE TAMBIÉN
Páginas de Manual Genéricas
awk(1), cmp(1), diff(1), find(1), perl(1), sed(1), sort(1), xargs(1), read(2), pcre2(3), pcre2syntax(3),
pcre2pattern(3), terminfo(5), glob(7), regex(7)
Documentación Completa
A complete manual ⟨https://www.gnu.org/software/grep/manual/⟩ is available. If the info and grep
programs are properly installed at your site, the command
info grep
debería acceder al manual completo.
TRADUCCIÓN
La traducción al español de esta página del manual fue creada por Gerardo Aburruzaga García
<gerardo.aburruzaga@uca.es> y Marcos Fouces <marcos@debian.org>
Esta traducción es documentación libre; lea la GNU General Public License Version 3
⟨https://www.gnu.org/licenses/gpl-3.0.html⟩ o posterior con respecto a las condiciones de copyright. No
existe NINGUNA RESPONSABILIDAD.
Si encuentra algún error en la traducción de esta página del manual, envíe un correo electrónico a
⟨debian-l10n-spanish@lists.debian.org⟩.
GNU grep 3.11 2019-12-29 GREP(1)