Re: parsing script help please

2012-05-31 Thread nathalie
You want something like this: #!/software/bin/perl use warnings; use strict; my $file = "example.txt"; open my $in, '<', $file or die "Cannot open '$file' because: $!"; while ( <$in> ) { next if /^#/; chomp; my ( $key, @fields ) = split /\t/; print map "$key\t$_\n", @fields;

Re: parsing script help please

2012-05-31 Thread nathalie
thanks a lot Rob I would like an output without the $VAR... so I did add this after the push function and it is perfect, thanks a lot again foreach my $number(@othernumbers){print $rownum,"\t",$elet, "\n";} #!/usr/local/bin/perl use strict; use warnings; my $fh; my %results; open ( $fh,

Re: parsing script help please

2012-05-31 Thread John W. Krahn
nathalie wrote: Hi Hello, I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 4483180-4483486

Re: parsing script help please

2012-05-31 Thread Rob Coops
On Thu, May 31, 2012 at 11:37 AM, nathalie wrote: > > > Hi > I have this format of file: (see attached example) > 1 3206102-3207048 3411782-3411981 3660632-3661428 > 2 4481796-4482748 4483180-4483486 > > > and I would like to change it to this > 1 3206102-3207048 > 1 34117

parsing script help please

2012-05-31 Thread nathalie
Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 44

Re: File Size Script Help - Working Version

2012-01-03 Thread Brandon McCaig
Hello: On Sat, Dec 31, 2011 at 02:56:50AM +0200, Igor Dovgiy wrote: > $filedata{$_} = [$filesize, $filemd5]; *snip* > my ($size, $md5) = @{ $filedata{$filename} }; Alternatively, store a nested hash-reference: $filedata{$File::Find::name} = { md5 => $file_md5, size => $file_s

Re: File Size Script Help - Working Version

2012-01-03 Thread Igor Dovgiy
Hi folks, happy new year to everyone. ) John, you're right, of course. ) The filenames in nested directories could well overlap, and using $File::Find::name would be safer. Didn't think of that as a big problem, though, as original script (with 'opendir') ignored all the nested folders overall. J

Re: File Size Script Help - Working Version

2012-01-02 Thread Jonathan Harris
On Sat, Dec 31, 2011 at 4:29 AM, John W. Krahn wrote: > Igor Dovgiy wrote: > >> Great work, Jonathan! >> Notice how simple your script has become - and that's a good sign as well >> in Perl. :) We can make it even simpler, however. >> >> As you probably know, Perl has two fundamental types of col

Re: File Size Script Help - Working Version

2011-12-30 Thread John W. Krahn
Igor Dovgiy wrote: Great work, Jonathan! Notice how simple your script has become - and that's a good sign as well in Perl. :) We can make it even simpler, however. As you probably know, Perl has two fundamental types of collections: arrays (where data is stored as a sequence of elements, data c

Re: File Size Script Help - Working Version

2011-12-30 Thread Igor Dovgiy
Great work, Jonathan! Notice how simple your script has become - and that's a good sign as well in Perl. :) We can make it even simpler, however. As you probably know, Perl has two fundamental types of collections: arrays (where data is stored as a sequence of elements, data chunks) and hashes (wh

Re: File Size Script Help - Working Version

2011-12-30 Thread Jonathan Harris
On Fri, Dec 30, 2011 at 7:11 PM, Brandon McCaig wrote: > On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote: > > Hi All > > Hello Jonathan: > > (Disclaimer: I stayed up all night playing Skyrim and am running > on about 4.5 hours of sleep.. ^_^) > > I think most things have already b

Re: File Size Script Help - Working Version

2011-12-30 Thread Brandon McCaig
On Thu, Dec 29, 2011 at 03:43:19PM +, Jonathan Harris wrote: > Hi All Hello Jonathan: (Disclaimer: I stayed up all night playing Skyrim and am running on about 4.5 hours of sleep.. ^_^) I think most things have already been addressed, but I think Igor might have had a bit of trouble making i

Re: File Size Script Help - Working Version

2011-12-30 Thread Jonathan Harris
On Fri, Dec 30, 2011 at 11:58 AM, Igor Dovgiy wrote: > Hi John, yes, good point! Totally forgot this. ) Adding new files to a > directory as you browse it is just not right, of course. Possible, but not > right. ) > > I'd solve this by using hash with filenames as keys and collected 'result' > st

Re: File Size Script Help - Working Version

2011-12-30 Thread Igor Dovgiy
Hi John, yes, good point! Totally forgot this. ) Adding new files to a directory as you browse it is just not right, of course. Possible, but not right. ) I'd solve this by using hash with filenames as keys and collected 'result' strings (with md5 and filesizes) as values, filled by File::Find tar

Re: File Size Script Help - Working Version

2011-12-30 Thread Igor Dovgiy
Hi Jonathan, Argh, really stupid mistake by me. ) But let's use it to explain some points a bit further, shall we? A skilled craftsman knows his tools well, and Perl programmer (with CPAN as THE collection of tools of all sizes and meanings) has an advantage here: even if documentation is a bit va

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: FInally, I was advised by a C programmer to declare all variables at the start of a program to avoid memory issues Is this not necessary in Perl? It is not really necessary in C either. John -- Any intelligent fool can make things bigger and more complex... It takes

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote: Igor made a lot of good points. Here are my two cents worth. You are using the File::Find module to traverse the file system and add new files along the way. This _may_ cause problems on some file systems. It would

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Fri, Dec 30, 2011 at 12:33 AM, Jonathan Harris wrote: > > > On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote: > >> Jonathan Harris wrote: >> >>> >>> Hi Igor >>> >>> Many thanks for your response >>> >>> I have started reviewing the things you said >>> There are some silly mistakes in there

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn wrote: > Jonathan Harris wrote: > >> >> Hi Igor >> >> Many thanks for your response >> >> I have started reviewing the things you said >> There are some silly mistakes in there - eg not using closedir >> It's a good lesson in script vigilance >> >> I

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: Hi Igor Many thanks for your response I have started reviewing the things you said There are some silly mistakes in there - eg not using closedir It's a good lesson in script vigilance I found the part about opening the file handle particularly interesting I had no idea

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Thu, Dec 29, 2011 at 5:08 PM, Igor Dovgiy wrote: > Hi Jonathan, > > Let's review your script a bit, shall we? ) > It's definitely good for a starter, but still has some rough places. > > #!/usr/bin/perl >> # md5-test.plx >> use warnings; >> use strict; >> > use File::Find; >> > use Digest::MD

Re: File Size Script Help - Working Version

2011-12-29 Thread Igor Dovgiy
Hi Jonathan, Let's review your script a bit, shall we? ) It's definitely good for a starter, but still has some rough places. #!/usr/bin/perl > # md5-test.plx > use warnings; > use strict; > use File::Find; > use Digest::MD5; > use File::Spec; > So far, so good. ) > my $dir = shift || '/Users/j

re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
Hi All Firstly, many thanks for your help previously (19/12/11) - it has led to making a useable script I don't think it's brilliantly written, it seems a little bodged together to me... but works fine - not a bad result for a first script If you are new to this problem and are interested in

Re: File Size Script Help

2011-12-19 Thread Jonathan Harris
On Mon, Dec 19, 2011 at 8:09 PM, Shlomi Fish wrote: > Hi Jonathan, > > some comments on your code - both positive and negative. > > On Mon, 19 Dec 2011 19:32:10 + > Jonathan Harris wrote: > > > Hi Perl Pros > > > > This is my first call for help > > > > I am a totally new, self teaching, Per

Re: File Size Script Help

2011-12-19 Thread Jonathan Harris
On Mon, Dec 19, 2011 at 8:08 PM, Jim Gibson wrote: > On 12/19/11 Mon Dec 19, 2011 11:32 AM, "Jonathan Harris" > scribbled: > > > Hi Perl Pros > > > > This is my first call for help > > > > I am a totally new, self teaching, Perl hopeful > > > > If my approach to this script is simply wrong, pl

Re: File Size Script Help

2011-12-19 Thread Shlomi Fish
Hi Jonathan, some comments on your code - both positive and negative. On Mon, 19 Dec 2011 19:32:10 + Jonathan Harris wrote: > Hi Perl Pros > > This is my first call for help > > I am a totally new, self teaching, Perl hopeful > > If my approach to this script is simply wrong, please le

Re: File Size Script Help

2011-12-19 Thread Jim Gibson
On 12/19/11 Mon Dec 19, 2011 11:32 AM, "Jonathan Harris" scribbled: > Hi Perl Pros > > This is my first call for help > > I am a totally new, self teaching, Perl hopeful > > If my approach to this script is simply wrong, please let me know as it > will help my learning! > > The script aims

re: File Size Script Help

2011-12-19 Thread Jonathan Harris
Hi Perl Pros This is my first call for help I am a totally new, self teaching, Perl hopeful If my approach to this script is simply wrong, please let me know as it will help my learning! The script aims to: 1) Read in a directory either from the command line, or from a default path 2) Produce

Re: perl script help

2011-10-13 Thread james varghese
Thanks for the Suggestions Ken Slater and Jin Gibson. Sorry for the missing information's. Exactly what you people predicted is correct.($k is a file counter starting at zero, and $Line_Counter is a line counter starting at one) Script is modified according to the suggestions given by you and no

Re: perl script help

2011-10-11 Thread Jim Gibson
On 10/11/11 Tue Oct 11, 2011 5:31 AM, "james varghese" scribbled: > hi, > I am new to perl programming.I am trying with the following script and > need help for it. > > I consolidated 10 excel files(in .txt format) which has same headers > in it and so i made it 1 common header at the top.Whil

RE: perl script help

2011-10-11 Thread Ken Slater
> From: james varghese [mailto:james2...@gmail.com] > Sent: Tuesday, October 11, 2011 8:31 AM > To: beginners@perl.org > Subject: perl script help > > hi, > I am new to perl programming.I am trying with the following script and > need help for it. > > I consolidated

perl script help

2011-10-11 Thread james varghese
hi, I am new to perl programming.I am trying with the following script and need help for it. I consolidated 10 excel files(in .txt format) which has same headers in it and so i made it 1 common header at the top.While doing it,in final output file i see a blank row at the beginning of every file c

Re: first perl script...help anyone?

2008-04-15 Thread John W. Krahn
Meriadoc Overhill of Nobottle wrote: HI all, Hello, I.m very new to Perl, but I've been told it's such a powerful language for text processing I wanted to try it and learn. So, I'm writing my first script which I need to process some text file. Welcome. Basically that's what I want to do:

first perl script...help anyone?

2008-04-15 Thread Meriadoc Overhill of Nobottle
HI all, I.m very new to Perl, but I've been told it's such a powerful language for text processing I wanted to try it and learn. So, I'm writing my first script which I need to process some text file. Basically that's what I want to do: I have 3 files, I want to read some informations from the firs

Re: help with reading file script | Help !!

2007-10-19 Thread Chance Ervin
You may want to consider using a mod for the mailer. I usually use Mail::Mailer for a task such as this. use strict; use warnings; Good practice. Chance Ervin Senior Systems Engineer Intelenet Communications NOC 949 784-7911 [EMAIL PROTECTED] On Fri, 19 Oct 2007 14:14:44 -070

Re: help with reading file script | Help !!

2007-10-19 Thread Tom Phoenix
On 10/19/07, Juan B <[EMAIL PROTECTED]> wrote: > I need a script to read /var/log messages and each > time it sees a line with the word "IDS" it will send > the whole line via mail to the administrator > #!/usr/local/bin/perl > > $file = '/var/log/messages'; # Name the file > open(INFO,

help with reading file script | Help !!

2007-10-19 Thread Juan B
Hi all !! im really new to perl so please bare with me and help.. I need a script to read /var/log messages and each time it sees a line with the word "IDS" it will send the whole line via mail to the administrator of the IDS, here is an example of such a line: Oct 19 15:40:30 172.31.0.254 %PIX-4

Re: script help

2007-08-04 Thread Mr. Shawn H. Corey
Tony Heal wrote: Below is a script I have been working on that verifies if another script has created the MD5 hash file correctly. The below works with if ( $checkFile = $file ) This assigns the content of $file to $checkFile and executes the block if it's content is not false (i

script help

2007-08-04 Thread Tony Heal
Below is a script I have been working on that verifies if another script has created the MD5 hash file correctly. The below works with if ( $checkFile = $file ) but not if if ( $checkFile != $file ) and I do not understand why that is. Can someone explain what I

Re: clamav stats script help

2006-05-24 Thread Chris
On Wednesday 24 May 2006 8:58 pm, Frank D. Gunseor wrote: > Maybe your machine is clean - there are no viruses to detect? > > Wed May 24 18:33:49 2006 -> Accepted connection on port 1451, fd 8 Wed > May 24 18:33:49 2006 -> stream: > Html.Phishing.Bank.Gen503.Sanesecurity.06042004 FOUND Wed May

Re: clamav stats script help

2006-05-24 Thread Chad Perrin
On Wed, May 24, 2006 at 06:58:34PM -0700, Frank D. Gunseor wrote: > Maybe your machine is clean - there are no viruses to detect? > > -Original Message- > From: Chris [mailto:[EMAIL PROTECTED] > > Html.Phishing.Bank.Gen503.Sanesecurity.06042004 FOUND Wed May 24 18:33:52 > Html.Phish

RE: clamav stats script help

2006-05-24 Thread Frank D. Gunseor
Maybe your machine is clean - there are no viruses to detect? -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 6:55 PM To: beginners@perl.org Subject: clamav stats script help I've downloaded a script that is supposed to output stats on vi

clamav stats script help

2006-05-24 Thread Chris
I've downloaded a script that is supposed to output stats on virus's that clamav detects.  Needless to say its not working correctly and I'm soliciting some help since I know nothing about perl.  I'm sort of getting output however it doesn't show any virus's detected.  I'd attach the script but

Re: perl script help

2006-04-04 Thread Irfan J Sayed
Thanks Ryan. It is working now. Regards Irfan Sayed Ryan Gies <[EMAIL PROTECTED]> 04/05/2006 11:18 AM To Ryan Gies <[EMAIL PROTECTED]> cc beginners@perl.org Subject Re: perl script help > Your file should be at: C:/per/lib/Mail/Sendmail.pm > Uh, make that:

Re: perl script help

2006-04-04 Thread Ryan Gies
Your file should be at: C:/per/lib/Mail/Sendmail.pm Uh, make that: C:/perl/lib/Mail/Sendmail.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: perl script help

2006-04-04 Thread Ryan Gies
If you have sendmail.pm (with a lower-case 's') it surely isn't the same thing as Sendmail.pm (with an upper-case 'S'). The MS Windows PATH environment variable is much different than Perl's @INC. Fortunately for you, your @INC includes C:/perl/lib. Your file should be at: C:/per/lib/Mail/Se

perl script help

2006-04-04 Thread Irfan J Sayed
Hi All, I have written a script to send a mail but when i am running that script i am getting following error. Can't locate Mail/Sendmail.pm in @INC (@INC contains: C:\irfan\ C:/perl/lib C:/p erl/site/lib .) at C:\irfan\DELIVE~2.PL line 30. BEGIN failed--compilation aborted at C:\irfan\DELIVE~2

Re: Script help

2003-08-16 Thread Ramprasad
Keith Olmstead wrote: Hello, I am neeing some help on a script that I am writing. Here is what I have so far: my $startdir = "/opt/log/hosts/"; use File::Find; #use strict; use warnings; my @dirlist; @logfile = ("cron","messages","maillog","ldap"); foreach $log (@logfile) { sub eachFile { if

Script help

2003-08-14 Thread Keith Olmstead
Hello, I am neeing some help on a script that I am writing. Here is what I have so far: my $startdir = "/opt/log/hosts/"; use File::Find; #use strict; use warnings; my @dirlist; @logfile = ("cron","messages","maillog","ldap"); foreach $log (@logfile) { sub eachFile { if (-e $_ && $_ =~ /$log$

Re: Email Script Help

2002-10-24 Thread Steve Grazzini
Bill O'Reilly <[EMAIL PROTECTED]> wrote: > > I am trying to setup a script on a linux (RedHat 7.3) box that > when someone copies a file to a particular folder it would trigger > an email being sent to a user. There are multiple folders I would > like to add this script to that all I would need

Re: Email Script Help

2002-10-24 Thread Mark Goland
code, to find if it can report a creation of a new file. Mark - Original Message - From: "Bill O'Reilly" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 23, 2002 3:00 PM Subject: Email Script Help > Hi, > > I am trying to setup a

Email Script Help

2002-10-24 Thread Bill O'Reilly
Hi, I am trying to setup a script on a linux (RedHat 7.3) box that when someone copies a file to a particular folder it would trigger an email being sent to a user. There are multiple folders I would like to add this script to that all I would need to do would be to change the subject line of the

Search Script Help

2002-01-23 Thread Troy May
Hello, I downloaded a search script that is perfect for what I'm looking for, but there's one problem that I can't figure out. In it, there's a variable for what files and/or directories that you do NOT want searched ($DMZ). I can't find the correct format to put in here and the script's tech s

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Steve Aaron
1 2:50 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [Perl-unix-users] Script Help Please Steve, I made the correction as follows: if (/\bUP\b/ && /$server_name/) Does not work. I also tried: if (/$server_name/) Does not work. And: if (/\b$server_name

Re: Script Help Please

2001-11-26 Thread Randal L. Schwartz
> "Craig" == Craig Sharp <[EMAIL PROTECTED]> writes: Craig> my %servers; (This is defining a hash?) Craig> open (I understand) Craig> { Craig> chomp (my @temp = ); (Removing the newline from each entry) Craig> @server{ @temp } =(); (What's this do?); Craig> } It's a hash slice, which contra

Re: Script Help Please

2001-11-26 Thread Craig Sharp
John, Thanks for the info. I am a bit confused in the first part of the script. my %servers; (This is defining a hash?) open (I understand) { chomp (my @temp = ); (Removing the newline from each entry) @server{ @temp } =(); (What's this do?); } Thanks, Craig >>> "John W. Krahn" <[EMAIL PROT

Re: Script Help Please

2001-11-26 Thread John W. Krahn
Craig Sharp wrote: > > I am lost. I have the following script that opens the log file WUGEvent.log and >looks for the > statment "UP", replaces spaces and writes out the new log file. It works great! > > Here is the problem. I need to read in another file (wuglist.txt) containing a list >of

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Craig Sharp
hat occurs least frequently on the left of the && as the right-hand side is only evaluated if the left-hand expression returns true. Steve Aaron -Original Message- From: Craig Sharp [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 12:45 PM To: [EMAIL PROTECTED] Cc:

RE: Script Help Please

2001-11-26 Thread Jonathan E. Paton
> Can anyone confirm if I understand this right: > > if ( $username =~ /@/ ) > { >$_ = $username; >($username) = /(.*)\@/; > } > > The part > ($username) = /(.*)\@/; > removes the @ symbol? Yes, but what if you've got two @'s? ;-) The two lines in the 'if' can be rewritten as: $us

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Steve Aaron
PROTECTED]] Sent: Monday, November 26, 2001 12:45 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [Perl-unix-users] Script Help Please Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes

RE: Script Help Please

2001-11-26 Thread Scott Ryan
November 2001 12:45 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Script Help Please Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes out the new log file. It works great! Here is the p

Script Help Please

2001-11-26 Thread Craig Sharp
Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes out the new log file. It works great! Here is the problem. I need to read in another file (wuglist.txt) containing a list of server names and then