Hi all,

I'm trying to get the output of a command and split it into a list that I
can process.  What is the best way to go about doing this? In bash I would
use tools like grep, sed awk etc.

Here's an example:

ifconfig

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:84253 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84253 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11763964 (11.2 MiB)  TX bytes:11763964 (11.2 MiB)

I would like to end up with something like this in a file:

<unix timestamp>,lo,rx_errors=0,rx_dropped=0,rx_overruns=0,rx_frame=0

Thanks,
Gareth
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to