On 05/12/2011 09:57 AM, Mircea MITU wrote:
> Salut
>
> Am un script ce scoate la output secvente de tipul:
>
> May 12 01:50:08 from=<[email protected]>, size=95701, nrcpt=1 (queue active)
> May 12 01:50:08 to=<[email protected]>, relay=dovecot, delay=0.35, 
> delays=0.22/0/0/0.13, dsn=2.0.0, status=sent (delivered via dovecot service)
>
> Am nevoie sa filtrez liniile preferabil intr-un singur pas (script1 |
> script2) astfel incat sa scot un output de genul
>
> May 12 01:50:08 from=<[email protected]>, size=95701
> May 12 01:50:08 to=<[email protected]>, status=sent (delivered via dovecot service)
>
> Mai pe romaneste, daca are "from" sa execut un "cut" cu anumiti
> parametri, iar daca e to, sa execut alt cut cu alti parametri.
>
> Any hints?
>
> Multumesc
>
>
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.lug.ro/mailman/listinfo/rlug

Intr-un singur pas:

awk ' { if($4 ~ /from/) {print  $1" " $2" " $6 }}; { if($4 ~ /to/) 
{print  $2" " $3" " $6 }}; '  LOG

Mai multe detalii:  http://www.grymoire.com/Unix/Awk.html#uh-53

Hth,
Mihai


_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui