2010-02-21 02:41:41 +0000 2010-02-21 02:41:41 +0000

Risposte (2)

Soluzione trovata!

Punteggio 132
2010-02-21 02:52:47 +0000

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.

Advertisement
Punteggio 3
2019-08-22 21:13:48 +0000

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.