Alan, Peter, et al:
Thank you all very much! Staring at this problem for hours was driving
me crazy and I am very appreciative for your guys' time in looking
into my silly error -- I have thoroughly reviewed both the responses
and it makes perfect sense (*sigh of relief*).
On Thu, Oct 2, 2014 a
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
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
John Doe wrote:
> Hello List,
> I am in need of your assistance. I have a text file with random words
> in it. I want to write all the lines to a new file. Additionally, I am
> using Python 2.7 on Ubuntu 12.04:
>
> Here is my code:
>
> def loop_extract():
> with open('words.txt', 'r') as f:
On 02/10/14 16:47, John Doe wrote:
def loop_extract():
with open('words.txt', 'r') as f:
for lines in f:
#print lines (I confirmed that each line is successfully printed)
with open('export.txt', 'w') as outf:
This opens and closes the file for each itera
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
Hello List,
I am in need of your assistance. I have a text file with random words
in it. I want to write all the lines to a new file. Additionally, I am
using Python 2.7 on Ubuntu 12.04:
Here is my code:
def loop_extract():
with open('words.txt', 'r') as f:
for lines in f:
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
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
On 09/24/2014 05:19 AM, questions anon wrote:
Ok, I am continuing to get stuck. I think I was asking the wrong question
so I have posted the entire script (see below).
What I really want to do is find the daily maximum for a dataset (e.g.
Temperature) that is contained in monthly netcdf files whe
* 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
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
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
I've been using Python3 for a while now so forgot how Python 2
handled input errors.
You could use Python 2 but you'd need to replace input() with raw_input().
But for learning I'd advise you to stick with Python3, just don't delete
python2 from your PC since several Linux tools rely on it.
A
14 matches
Mail list logo