Arquivo da tag: grep

shellscript grep e sed: pegando apenas e-mails

fonte: https://www.shellhacks.com/regex-find-email-addresses-file-grep/

um melhor:

echo ” sv sdf example@gmail.com.br ; k l ; examplo@rdfgfdet.com ; asdsad@asdsad.com.54.gh ; ” |grep -E -o “\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b”|sed ‘:a;N;$!ba;s/\n/,/g’

Continuar lendo

contar linhas de arquivos muito grandes

dicas do site: https://stackoverflow.com/questions/12716570/count-lines-in-large-files

6

 (GREP, SED, AWK, PERL, WC). Here is the result of the test that I ran on a file which had 23782409 lines

time grep -c $ my_file.txt;

real 0m44.96s user 0m41.59s sys 0m3.09s

time wc -l my_file.txt;

real 0m37.57s user 0m33.48s sys 0m3.97s

time sed -n '$=' my_file.txt;

real 0m38.22s user 0m28.05s sys 0m10.14s

time perl -ne 'END { $_=$.;if(!/^[0-9]+$/){$_=0;};print "$_" }' my_file.txt;

real 0m23.38s user 0m20.19s sys 0m3.11s

time awk 'END { print NR }' my_file.txt;

real 0m19.90s user 0m16.76s sys 0m3.12s

pesquisar por arquivos que contem texto

fonte: https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux

pesquisar por arquivos que contenham o texto dentro deles:

find / -type f -exec grep -H 'text-to-find-here' {} \;

 

linux dicas – cut e paste

Como recortar e colar em sistemas Unix – Dicas.

linux dicas – grep

linux dicas – comando grep