mercoledì 4 giugno 2014

Analisi log: cercare tutte le ricorrenze di un parametro

Ipotizziamo un log che contenga linee del tipo:

DATA ORA CODICE I=dfjhsdf U=root O=eruyer
DATA ORA CODICE I=dfjhsdf U=utente O=eruyer
DATA ORA CODICE S=hdhgfgd I=dfjhsdf U=utente O=eruyer
DATA ORA CODICE S=hdhgfgd I=dfjhsdf U=mario O=eruyer

Vogliamo estrarre la lista degli utenti (nell'esempio il parametro U), possiamo usare questo comando:

grep -o "\ U=.*\ " FILE_DI_LOG | cut -f 2 -d\

Nessun commento: