[Tutor] Regular expressions...
Spencer Parker
inthefridge at gmail.com
Fri May 2 18:08:04 CEST 2008
I need to use a regular expression to get a couple of items for my python
script. So far the script is running an 'ls' command to get a few items
that I need
I run an 'ls -sk /xen/domains2/machinename/disk.img'
Output
2454112 /xen/domains2/machinename/disk.img
Then I have it running an 'ls -lk /xen/domains2/machinename/disk.img
output:
-rw-r--r-- 1 root root 20980736 May 2 10:05
/xen/domains2/machinename/disk.img
Then I take those two number and divide them using the the used amount by
the actual size of the disk to get a percentage. I take all of that data
and then stick it into a database.
What I need to get is just the size numbers using regular expressions. I
tried using an index, but since the disk images can up to 20 gig and be as
low as 5 gig...the index changes. I also need to get the 'machinename'
portion of the path as well to stick into the database.
--
Spencer Parker
_______________________________________________________
"if you can't go to heaven, may you at least die in Ireland."
_______________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080502/d5304751/attachment-0001.htm>
More information about the Tutor
mailing list