Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread Martin A. Brown
Hi Bo, I am trying to write a python script that will run the above command and only print out the IP's that begin with 25. How do I strip out all other text except for the IP's that begin with "25?" I liked the suggestion by John Doe earlier that this is a pretty good case for 'grep', but

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread Alan Gauld
On 02/10/14 16:41, Bo Morris wrote: of the following output 087-888-279 Pandora25.x.x.xxx alias: not set 096-779-867 AM1LaptopBD-PC25.x.x.xxx alias: not set 097-552-220 OWS-Desktop 125.0.0.0 alias: not set

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread John Doe
Hello, If you want to accomplish what you are looking for within linux (perhaps a bash script, instead?): $ hamachi list | grep -oP '25\.\d+\.\d+\.\d+' 25.0.0.0 25.255.255.255 For your python script, you want to group your regex: reg = re.compile(r'(25\.\d+\.\d+\.\d+)', re.MULTILINE) So when yo

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread Sebastian Silva
El jue, 2 de oct 2014 a las 11:33 AM, David Rock escribió: A regex may be possible, but you will have similar issues to using split. In my humble experience, a regex is the way to go: import re ip = re.findall( r'[0-9]+(?:\.[0-9]+){3}', s ) you will get a list of IP addresses and can fil

Re: [Tutor] printing all text that begins with 25"

2014-10-02 Thread Crush
Yes the format is always the same and the IPs will always be in the 3rd collumn; although, the amount of whitspace that seperates column 2 and 3 may be different depending on how long the name is in column 2. Also all of the IPs will begin with a "25," so there would be no fear of having to deal

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread David Rock
* Bo Morris [2014-10-02 11:41]: > Hello all, hope everyone is doing well. > > When I run the linux command "hamachi list" i get something along the lines > of the following output > >087-888-279 Pandora25.x.x.xxx alias: not > set >096-779-867 AM1Lap

Re: [Tutor] printing all text that begins with "25"

2014-10-02 Thread Dave Angel
Bo Morris Wrote in message: (Thanks for starting a new thread when asking a new question. But please use text mode in your emails, not html.) For the first version, write it as a filter, and pipe the two commands together in the shell. So all you have to do is read a line from stdin, parse

[Tutor] printing all text that begins with "25"

2014-10-02 Thread Bo Morris
Hello all, hope everyone is doing well. When I run the linux command "hamachi list" i get something along the lines of the following output 087-888-279 Pandora25.x.x.xxx alias: not set 096-779-867 AM1LaptopBD-PC25.x.x.xxx alias: not set