[Linux-Biella] awk cut caz maz...

LeOS linux@ml.bilug.linux.it
Thu, 18 Mar 2004 18:14:43 +0100


buonagiorgio
mi sta fumando la mente...
ho una cosa di questo tipo:

03/18-17:20:26.215086 192.168.7.11:60826 -> 192.168.7.2:161
03/18-17:20:26.786936 192.168.7.11:60826 -> 192.168.7.2:705
03/18-17:20:26.817741 192.168.7.11:60826 -> 192.168.7.2:8080

vorrei con una simpatica combinazione di awk e cut ottenere qualcosa
tipo:

192.168.7.11 17:20
192.168.7.11 17.20
192.168.7.11 17.20

(od anche 17:20 192.168.7.11  che posso invertire con awk print $2 $1)


il massimo che son riuscito ad ottenere e':

17:20:192.168.7.11
17:20:192.168.7.11
17:20:192.168.7.11

con un comando malato come:

 cat file |cut -f 1,2 -d " "|cut -f2 -d -|cut -f 1,2,3 -d :|awk '{print
$1":"$2}'|cut -f 1,2,4 -d :

idee per rendermi la vita piu' semplice?

bai


-- 

main(){int n=-1;char c[]="qiruAbhjrc)fbfln#]g";
while(c[n]!='g'){putchar(c[++n]-'\05'+n);}return 0;}


Linux Registered User #135079

public gpg key: gpg --keyserver pgp.mit.edu --recv-key 2ED92C69