Skip to content

Instantly share code, notes, and snippets.

@sangar82
Created December 15, 2016 12:15
Show Gist options
  • Save sangar82/0edf00f51e683a47195569404aca5173 to your computer and use it in GitHub Desktop.
Save sangar82/0edf00f51e683a47195569404aca5173 to your computer and use it in GitHub Desktop.
Buscar todas las lineas que contengan 'campaigns/' y 'info'
````bash
grep -e "campaigns/" *.log | grep -e "info"
````
Contar todas las líneas que contengan 'campaigns/' y 'info'
````bash
grep -e "campaigns/" *.log | grep -e "info" | wc -l
````
Buscar todas las lineas que contengan 'campaigns/' y que diga el número de fila
````bash
grep -e "campaigns/" *.log -n
````
Buscar todas las lineas que contengan 'campaigns/' y devuelve tres lineas antes (B = before) y tres lineas despues (A = after)
````bash
grep -e "campaigns/" *.log -B 3 -A 3
````
Buscar todas las lineas que contengan 'campaigns/' y devuelve lineas coloreadas con los resultados
````bash
grep -e "campaigns/" *.log --color=auto
````
Buscar todas las lineas que contengan 'campaigns/' y devuelve solo la ultima fila
````bash
grep -ve "campaigns/" *.log |tail -n 1
````
Buscar todas las lineas que contengan 'campaigns/' y devuelve el resultado en una screen que permite búsquedas y paginado
````bash
grep -e "campaigns/" *.log -n| less
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment