[nycbug-talk] Text parsing question

maddaemon at gmail.com maddaemon at gmail.com
Sat Jan 3 16:28:49 EST 2009


On Wed, Dec 31, 2008 at 3:09 PM, James E Keenan <jkeen at verizon.net> wrote:
>
> On Dec 31, 2008, at 12:10 PM, maddaemon at gmail.com wrote:
>
>>
>> Since I don't know Perl (yet), I showed that to my boss, who then
>> modified it,
>
> Why?  In what way did it not solve your problem?

It resulted in only returning a single line.

> I ask this not out of wounded vanity, but because further diagnosis is
> difficult without knowing in what way my suggestion was inadequate.
>
> Note:  Your original post presented very little data, so I had to make up
> sample data in order to illustrate an approach toward a solution.

My boss also rewrote some of my code, and he added the parens.

>> but his Perl has some rust on it, and it winds up puking
>> a lot.  Can anyone show me what should be fixed so I can get this
>> working and off my plate?
>
> As you note farther on, you are probably better off taking this question to
> a Perl list.  I would suggest perlmonks.org.  But whatever list you go to,
> the first feedback you get will be something like this:
>
> "You are using 'use strict;' and 'use warnings;' at the top of your program.
>  That's good, because they show you where your code is either suboptimal or
> simply wrong.  (perl -c yourscript)  But once those statements show you your
> errors, it's up to you to correct them.  Start with the first error reported
> and proceed from there."
>
>
>> Much thanks..
>>
>> Oh, and what would need to change so I could pull the data from a file
>> rather than appending the data to the bottom of the script?
>
> perldoc -f open
>
>> I realize
>> that this isn't the proper forum for this question
>
> See above.
>
>>
>> __DATA__
>> Dec 30 09:34:53 user1234 (tried logging in from 192.168.32.100)
>> Dec 30 09:34:53 user1234 (tried logging in from 192.168.32.7)
>> Dec 30 14:38:37 user5678 (tried logging in from 192.168.32.100)
>> Dec 30 14:38:37 user5678 (tried logging in from 192.168.32.8)
>> Dec 30 14:38:44 user5678 (tried logging in from 192.168.32.100)
>> Dec 30 14:38:44 user5678 (tried logging in from 192.168.32.8)
>
> The data you present here differs from what you originally presented and
> from the dummy data I made up in that there is no
> 'wordspace-hyphen-wordspace' between the datestamp and the username.  So you
> would have to modify the regular expression I wrote to reflect this
> difference.
>
> Jim Keenan
>

Understood.  Guess it's time I learned Perl anyway..

Thanks again for the input.



More information about the talk mailing list