Ejemplo 1: grep no coincide
Just filter your output with:
grep -v "excluded_pattern"
Example to get all not txt files in current directory.
ls | grep -v .txt
Ejemplo 2: tercera coincidencia grep
#Combine grep and tail for grepping until second match and filtering
#last with tail command
grep -m2 "two" in-file.txt | tail -n1
Ejemplo 3: primera coincidencia de grep
Just combine grep with head command for filtering only the first match as:
grep "match" | head -n 1 #Change 1 to not only match first but further matches
Ejemplo 4: grep o coincidencia
$ grep "PATTERN1|PATTERN2" FILE
$ grep -E "PATTERN1|PATTERN2" FILE
$ grep -e PATTERN1 -e PATTERN2 FILE
$ egrep "PATTERN1|PATTERN2" FILE
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)