Portál AbcLinuxu, 6. května 2025 14:19
Řešení dotazu:
find . -type f -print0 | xargs -0 egrep -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b"
[~][20:19:40] echo 'ferda@mravenec.com.au' | egrep -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" | nl 1 ferda@mravenec.com.auVyskúšať to bolo rýchlejšie ako písať otázku do diskusie. Trochu viac vlastnej iniciatívy by neškodilo.
find ./ -type f -print0 | xargs -0 egrep -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" | nl
Zmenil na executable, predlozil mu dva pdf soubory a dostal toto:
$ ./vysavac
Binary file ./LLBQLD New Handbook 12-13 FINAL 09.11.12.pdf matches
Binary file ./LMLS llb 2012-13.pdf matches
Emaily v souborech zrejme nasel, ale nedaly by se konkretne zobrazit, nebo dokonce ulozit do souboru?
-a, --text Process a binary file as if it were text; this is equivalent to the --binary-files=text option
strings '@'
ale to mi vratilo spoustu balastu. Kazdopadne diky za tip.
4 Binary file ./LLBQLD New Handbook 12-13 FINAL 09.11.12.pdf matches
5 Binary file ./LMLS llb 2012-13.pdf matches
Idealne bych asi potreboval aby find
nebo egrep
ignoroval binarni soubory, ze? Ale nevim jak to zaridit.
egrep -I
.
find ./ -type f -print0 | xargs -0 egrep -o -h "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" | sort | uniq -i | nl
Ale kdyz jsem jeden ze souboru zmenil na skryty (tecka na zacatku nazvu), tak uz se ve vysledcich neobjevil. Samotny find
skryty soubor najde; mam chybu v grep
prikazu?
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.