martes, 13 de septiembre de 2022

Linux grep

grep '^[A,E].*o' f.txt Find a string starting with A or E and ending in o

grep -f pat.txt f.txt Scan f.txt, using contents of pat.txt as regex

grep -i Gnu f.txt Find "gnu" in f.txt, ignoring capitalization

grep -v gnu f.txt Find all lines not containing "gnu" (invert match)

grep -w 'a.*o' f.txt Find whole word matches only, ignoring substrings 

grep -x 'a.*o' f.txt Find whole line matches only, as in ^(a.*o)$


https://opensource.com/sites/default/files/gated-content/osdc_cheatsheet-grep.pdf

No hay comentarios:

Publicar un comentario