Punteggio
79
Advertisement
Soluzione trovata!
Potete ottenere questo con le utility sort e uniq .
esempio:
[john@awesome ~]$ echo -e "test\ntest\ntest\nanother test\ntest" test test test another test test [john@awesome ~]$ echo -e "test\ntest\ntest\nanother test\ntest" | sort | uniq another test test
a seconda dei dati potresti voler utilizzare anche alcuni degli interruttori.
Potete usare:
grep -rohP "(mySearchString)" . | sort -u
-r: ricorsivo
-o: stampa solo la parte di testo corrispondente
-h: non stampa i nomi dei file
-P: regex in stile Perl (puoi usare invece -E a seconda del tuo caso)
sort -u è meglio di sort | uniq, come sottolineato da @Chris Johnsen.