From syslog to csv format

2007-01-18 Thread Michael Alipio
Hi, I have a script that parses firewall logs. The firewall can be set to export its logs in CSV format, and that is what we needed. However, sometimes, other firewalls are being left in a Syslog format, and upon reading the log files, I want to make sure I will convert it to CSV if in case it

Re: simple perl script on Windows

2007-01-18 Thread David Moreno Garza
On Thu, 2007-01-18 at 21:42 -0500, Mathew Snyder wrote: > Citlali had provided a regex that almost did what I wanted and then David gave > me one that did exactly what I wanted. Yay! We learn from everybody :-) David. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

Re: Searching hash if a given value exists

2007-01-18 Thread Mumia W.
On 01/18/2007 07:46 PM, Michael Alipio wrote: Hi, Suppose I have a hash: my %hash = (dog => 'house', pig => 'barn', bird=> 'cage'); Now I want to know if there is already a key with a 'house' value as I do not want to create another key with the same value. Is there any other faster way to do

Re: simple perl script on Windows

2007-01-18 Thread Mathew Snyder
Rob Dixon wrote: > Mathew Snyder wrote: >> Rob Dixon wrote: >>> Mathew wrote: I have a file with a list of subfolders. The list was created using dir and each entry is like thus: 12/12/2005 04:38 AM A Perfect Circle I then created a simple script th

Re: simple perl script on Windows

2007-01-18 Thread Rob Dixon
Mathew Snyder wrote: Rob Dixon wrote: Mathew wrote: I have a file with a list of subfolders. The list was created using dir and each entry is like thus: 12/12/2005 04:38 AM A Perfect Circle I then created a simple script that I hoped would eliminate everything prior to the last

Re: Searching hash if a given value exists

2007-01-18 Thread Rob Dixon
Michael Alipio wrote: Hi, Suppose I have a hash: my %hash = (dog => 'house', pig => 'barn', bird=> 'cage'); Now I want to know if there is already a key with a 'house' value as I do not want to create another key with the same value. Is there any other faster way to do it than doing a for (ke

Re: simple perl script on Windows

2007-01-18 Thread Mathew Snyder
Rob Dixon wrote: > Mathew wrote: >> I have a file with a list of subfolders. The list was created using dir >> and each entry is like thus: >> >> 12/12/2005 04:38 AM A Perfect Circle >> >> I then created a simple script that I hoped would eliminate everything >> prior to the last bit

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread David Moreno Garza
On Thu, 2007-01-18 at 07:11 -0800, Peter Scott wrote: > my $output = `myperlscript.pl 2>&1`; > send_email($output) if $output; Doubt: Isn't send_email($output) in this situation still going to happen? I mean, even of there is not output on "myperlscript.pl 2>&1", $output is going to be set, meani

Re: Searching hash if a given value exists

2007-01-18 Thread Jason Roth
Well it depends on what you mean by "too long", you could always just try it and see if it suites your needs. However if you can change the code that builds this hash, you could have it put the values into a hash as keys allowing for fast lookups later. Its kind of hard for me to make helpful su

Re: simple perl script on Windows

2007-01-18 Thread Rob Dixon
Mathew wrote: I have a file with a list of subfolders. The list was created using dir and each entry is like thus: 12/12/2005 04:38 AM A Perfect Circle I then created a simple script that I hoped would eliminate everything prior to the last bit of text which follows the big space

Re: Searching hash if a given value exists

2007-01-18 Thread Michael Alipio
- Original Message From: Jason Roth <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]> Cc: begginers perl.org Sent: Friday, January 19, 2007 9:53:49 AM Subject: Re: Searching hash if a given value exists Hi Michael, > To answer your questions, If you want to know if there is a

Re: Searching hash if a given value exists

2007-01-18 Thread Jason Roth
Hi Michael, To answer your questions, If you want to know if there is already a key with a certain value, you have to look through the entire hash. However if you want to see if a given key exists, just do "if (exists $hash{$key})". This will take constant time regardless of the number of elemen

Searching hash if a given value exists

2007-01-18 Thread Michael Alipio
Hi, Suppose I have a hash: my %hash = (dog => 'house', pig => 'barn', bird=> 'cage'); Now I want to know if there is already a key with a 'house' value as I do not want to create another key with the same value. Is there any other faster way to do it than doing a for (keys %hash){ if ($hash{$_

RE: Capturing stdout and stderr without redirection

2007-01-18 Thread Dan Fish
Igor, thanks for the tip! A search of CPAN turned up IPC::Open3::Simple Very cool... Very easy to use and exactly what I needed. Separate callback subs for STDOUT and STDERR... just push anything fed to them into an array... When all done, if array size > 0, fire off an email with the contents.

Re: simple perl script on Windows

2007-01-18 Thread David Moreno Garza
On Thu, 2007-01-18 at 11:44 -0500, Mathew wrote: > open FILE, "H:\My Music\folderlist.txt"; > > foreach my $line (readline FILE) { > $line =~ s/^.*\s//g; > open FILE2, "H:\My Music\artists.txt"; > print FILE2 $line . "\n"; > close FILE2; > } > > close FILE; I'd go w

Re: simple perl script on Windows

2007-01-18 Thread Tom Phoenix
On 1/18/07, Mathew <[EMAIL PROTECTED]> wrote: open FILE, "H:\My Music\folderlist.txt"; Use forward slashes instead of backslashes in filename strings, even on Windows. (Or, if you mean a true backslash, use two of them; a single backslash is always magical in Perl.) And check the return value

Re: simple perl script on Windows

2007-01-18 Thread I . B .
also keep open and close outside the loop. you overwriting previously written lines. open FILE2,"$file"; foreach @lines { print FILE2 $_; } close FILE2 cheers On 1/18/07, Mathew <[EMAIL PROTECTED]> wrote: Thanks. That likely will help. However, I still can't even get it to perform any action

Re: simple perl script on Windows

2007-01-18 Thread Mathew
Thanks. That likely will help. However, I still can't even get it to perform any action. I have it set to print to the screen right now but it isn't creating any output. Mathew Guerrero, Citlali (GE, Corporate, consultant) wrote: > Hi Mathew : > > This is what your regexp ($line =~ s/^.*\

simple perl script on Windows

2007-01-18 Thread Mathew
I have a file with a list of subfolders. The list was created using dir and each entry is like thus: 12/12/2005 04:38 AM A Perfect Circle I then created a simple script that I hoped would eliminate everything prior to the last bit of text which follows the big space. open FILE, "H

Re: need to extract attachments

2007-01-18 Thread Tom Phoenix
On 1/18/07, Brent Clark <[EMAIL PROTECTED]> wrote: Would anyone know of a perl script to extract an attachment. Have you searched CPAN? http://search.cpan.org/search?query=attachment&mode=all http://search.cpan.org Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubsc

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Peter Scott
On Wed, 17 Jan 2007 23:44:57 -0700, Dan Fish wrote: > I've got a perl wrapper that conditionally runs another perl program using > system() > > If( some_condition_applies){ > > system("myperlscript.pl"); > > } > > myperlscript.pl will complete silently if everything runs right, but > beca

need to extract attachments

2007-01-18 Thread Brent Clark
Hey all Would anyone know of a perl script to extract an attachment. If anyone could assist it would greatfully be appreciated. Kind Regards Brent Clark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: printf

2007-01-18 Thread Dermot Paikkos
On 18 Jan 2007 at 16:25, Eugene Kosov wrote: > Beginner wrote: > > Hi all, > > > > Sorry I am sure this is a lame question. > > > > I want to print out some column (with heading) and I want them > > evenly spaced. I know this is a printf but the format eludes me. > > > > printf("%c12", $var);

Re: printf

2007-01-18 Thread Beginner
On 18 Jan 2007 at 7:19, Hal Wigoda wrote: > for one thing, you need to add "\n" for newline. > > printf("%c12", $var); # prints $var12$var12 > > > > %s seems to give me no output at all. > > I wouldn't want a newline in the middle of my column heading. I would like a 12 character spacing betw

Re: printf

2007-01-18 Thread Eugene Kosov
Beginner wrote: Hi all, Sorry I am sure this is a lame question. I want to print out some column (with heading) and I want them evenly spaced. I know this is a printf but the format eludes me. printf("%c12", $var); # prints $var12$var12 Try %12c (or %12s) instead of %c12 above. -- To u

Re: printf

2007-01-18 Thread Hal Wigoda
for one thing, you need to add "\n" for newline. On Jan 18, 2007, at 7:12 AM, Beginner wrote: Hi all, Sorry I am sure this is a lame question. I want to print out some column (with heading) and I want them evenly spaced. I know this is a printf but the format eludes me. printf("%c12", $var)

Re: binmode, UTF8

2007-01-18 Thread Mumia W.
On 01/18/2007 05:13 AM, Eugene Kosov wrote: Hi, everyone! First of all, I'm sorry if this isn't a right place for such a question. I'm having troubles with concatenating 2 utf8 strings. The only difference (if I dont miss something) is 1st one is hardcoded to the script (see below) and the 2n

printf

2007-01-18 Thread Beginner
Hi all, Sorry I am sure this is a lame question. I want to print out some column (with heading) and I want them evenly spaced. I know this is a printf but the format eludes me. printf("%c12", $var); # prints $var12$var12 %s seems to give me no output at all. Any ideas? TIA, Dp. -- To uns

binmode, UTF8

2007-01-18 Thread Eugene Kosov
Hi, everyone! First of all, I'm sorry if this isn't a right place for such a question. I'm having troubles with concatenating 2 utf8 strings. The only difference (if I dont miss something) is 1st one is hardcoded to the script (see below) and the 2nd is recieved from STDIN. I get something st

RE: installing question

2007-01-18 Thread Keenan, Greg John (Greg)** CTR **
Please take the Gentoo discussion somewhere else. This list is for perl beginners to get help, not for silly distribution wars. Go play on Slashdot or something. On 1/9/07, Arvind Autar <[EMAIL PROTECTED]> wrote: > > debian. > > Gentoo has a whole history of open source distrobuters who boycot it

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Igor Sutton
Hi Dan, 2007/1/18, Dan Fish <[EMAIL PROTECTED]>: I've got a perl wrapper that conditionally runs another perl program using system() Something like: If( some_condition_applies){ system("myperlscript.pl"); } myperlscript.pl will complete silently if everything runs right, but becaus

Re: Capturing stdout and stderr without redirection

2007-01-18 Thread Ken Foskey
On Wed, 2007-01-17 at 23:44 -0700, Dan Fish wrote: > I've got a perl wrapper that conditionally runs another perl program using > system() > > IF there is any output from myperlscript.pl, I'd like to capture it and send > it off in an email. The sending in an email part I can handle. and I thin

Re: Mail::Sender

2007-01-18 Thread Beginner
On 18 Jan 2007 at 9:55, Brent Clark wrote: > To whom it may concern > > I have a problem whereby on sending an email, my mailserver does not allow > for ip, (needs to be wrapped in [] ). > > >> 220 mail.eccotours.co.za ESMTP Exim (Ecco Tours) 4.63 Wed, 17 Jan 2007 > >> 16:47:41 +0200 > << EHLO

Re: Mail::Sender

2007-01-18 Thread Jeff Pang
Hi, This is the peer email site's behavior,not Perl's behavior. Follow some rfc items (maybe rfc2821 or 2505),you should use your host's FQDN as HELO command's argument.Only when there is not FQDN for the host,you can use IP address as HELO's argument. Exim is a very flexible system,it can be us