[Tutor] Text Processing - Questions/Help.
David Bradshaw
dave_bradshaw at talk21.com
Thu Mar 14 11:30:51 CET 2013
I have written some code that logs into a list of hosts and runs a couple of commands to find out some information. Which I then save to a file and process.
A cut down version of the information I generate and save can be found here - http://pastebin.com/4ePz3Z7m
The code I have written to process this file can be found here - http://pastebin.com/WBbKydLg
I need to run the two commands when generating the information as in some cases we have a high speed expansion card installed and I need its MAC rather than the MAC of the on-board card. Why? As well as generating output to show the layout of each chassis, I also then want to use this information to generate a dhcpd.conf file. I have written the code to do it, but it suffers the same problem.
Currently when I run my code I get this as the output -
BBC21-14.ZONE21.WORK
178.28.185.89
6 vm14-6
06BNBB6
5C:F3:FC:C2:08:0C
7 vm14-7
06BNBM3
5C:F3:FC:C2:0D:48
8 s21-04
06KKY20
5C:F3:FC:79:53:50
00:10:18:E4:EA:EC
9 ps41.p33
06CZHR8
34:40:B5:DC:2C:50
00:10:18:E4:F3:2C
10 vm14-8
06BNBN6
5C:F3:FC:C1:F3:10
Any pointers as to how in the cases where 2 MACs are displayed I only display/output the second? Also there is no guarantee that in the future the second MAC will start with 00:10. From my code was it a fluke that I got the output formatted as it is and I actually need to rethink how I process the information?
Finally the information on pastebin, is it better or preferred that I add it all in this thread, rather the putting it in pastebin?
Thanks for any help provided.
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130314/5d150d08/attachment.html>
More information about the Tutor
mailing list