Re: how to produce random dates

2008-09-21 Thread John W. Krahn
Mr. Shawn H. Corey wrote: On Sat, 2008-09-20 at 03:53 -0700, John W. Krahn wrote: itshardtogetone wrote: Hi, Hello, How do I randomly produce a date between 1st Jan 1960 to 31th December 1985. It must be able to show the day month year. I only know how to produce a random number between 1960

Re: how to produce random dates

2008-09-21 Thread John W. Krahn
itshardtogetone wrote: - Original Message - From: "John W. Krahn" <[EMAIL PROTECTED]> use Time::Local; my $start = timegm 0,0,0,1,0,60; my $end = timegm 0,0,0,1,0,86; print scalar gmtime $start + rand $end - $start; Hi, Thanks. (1) But the above from time to time produce the fol

Re: Append a text file to an existing text file

2008-09-21 Thread NewbeeUnix
On Sep 18, 11:49 am, [EMAIL PROTECTED] (Back9) wrote: > Hello, > > Is there a way to append a text file to an existing text file. > For example, > File A: > Jan Feb Mar April ... > > File B: > 10 30 40 20 ... > > After appending job, the File A would be like below. > Jan Feb Mar April ... > 10 30 4

Re: How to append a text file to an existing text file

2008-09-21 Thread Back9
On Sep 19, 11:31 am, [EMAIL PROTECTED] (John W. Krahn) wrote: > Back9 wrote: > > Hello, > > Hello, > > > Is there a way to append a text file to an existing text file. > > For example, > > File A: > > Jan Feb Mar April ... > > > File B: > > 10 30 40 20 ... > > > After appending job, the File A woul

one-liner for if condition is met, substitute an incremented number

2008-09-21 Thread myperlfaq
Here's a string in my file, #define MY2D_STRING"4.0.1.999.9" of which I'm trying to increment the last digit; let's say with 1, such that the output is 4.0.1.999.10 I've tried _various_ combinations, here's just one of them. (This works partially, but not always). perl -i -pe 'if (

Re: one-liner for if condition is met, substitute an incremented number

2008-09-21 Thread Mr. Shawn H. Corey
On Fri, 2008-09-19 at 20:53 -0700, [EMAIL PROTECTED] wrote: > Here's a string in my file, > > #define MY2D_STRING"4.0.1.999.9" > > of which I'm trying to increment the last digit; let's say with 1, > > such that the output is 4.0.1.999.10 > > I've tried _various_ combinations, here'

Re: Append a text file to an existing text file

2008-09-21 Thread John W. Krahn
NewbeeUnix wrote: On Sep 18, 11:49 am, [EMAIL PROTECTED] (Back9) wrote: Is there a way to append a text file to an existing text file. For example, File A: Jan Feb Mar April ... File B: 10 30 40 20 ... After appending job, the File A would be like below. Jan Feb Mar April ... 10 30 40 20 ...

Re: one-liner for if condition is met, substitute an incremented number

2008-09-21 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Here's a string in my file, #define MY2D_STRING"4.0.1.999.9" of which I'm trying to increment the last digit; let's say with 1, such that the output is 4.0.1.999.10 I've tried _various_ combinations, here's just one of them. (This works partially, but not

how to redirect in system command two devices at once

2008-09-21 Thread Back9
Hello, I am calling system() to run a devenv.exe to build vs 2005 solution file. My problem is I want to capture the output while building the solution to a file and show the output to monitor at once. Is there a way or a module to achieve that goal? TIA -- To unsubscribe, e-mail: [EMAIL PROT

Re: how to redirect in system command two devices at once

2008-09-21 Thread Mr. Shawn H. Corey
On Fri, 2008-09-19 at 13:14 -0700, Back9 wrote: > Hello, > > I am calling system() to run a devenv.exe to build vs 2005 solution > file. > My problem is I want to capture the output while building the solution > to a file and show the output to monitor at once. > > Is there a way or a module to a

Understanding Perl script functionality

2008-09-21 Thread Stephen Reese
I am working on modifying a script that previously parsed Cisco ACL's and changing it to parse IPS information. Here is an example of the two log formats. Sep 19 15:44:29 172.16.2.1 59800: 3725router: Sep 19 19:44:39: %SEC-6- IPACCESSLOGP: list 104 denied udp 93.144.187.255(13157) -> 68.156.63.11

Re: Trying to modify Perl script

2008-09-21 Thread Dr.Ruud
"John W. Krahn" schreef: > Stephen Reese: >> chomp ($acl=$ARGV[0]); >> if ($acl eq "") { $acl=".*"}; > > my $acl = $ARGV[ 0 ] || '.*'; The chomp() can make a difference: $ perl -wle 'my $x = $ARGV[0] || q{.*}; print qq{<$x>}' '' <.*> $ perl -wle 'my $x = $ARGV[0] || q{.*}; print qq{<$x>}' ' '

Re: Understanding Perl script functionality

2008-09-21 Thread Ron Bergin
On Sep 19, 10:07 pm, [EMAIL PROTECTED] (Stephen Reese) wrote: > I am working on modifying a script that previously parsed Cisco ACL's > and changing it to parse IPS information. > > Here is an example of the two log formats. > > Sep 19 15:44:29 172.16.2.1 59800: 3725router: Sep 19 19:44:39: %SEC-6-

Re: Understanding Perl script functionality

2008-09-21 Thread Mr. Shawn H. Corey
On Sun, 2008-09-21 at 09:59 -0700, Ron Bergin wrote: > > > #!/usr/bin/perl > > # > You're missing 2 very important pragmas that should be in every script > you write. > > use warnings; # > use strict; # forces you to declare your vars prior to their use. > > > # > > # Set behaviour > > $log="/

Re: Understanding Perl script functionality

2008-09-21 Thread John W. Krahn
Mr. Shawn H. Corey wrote: On Sun, 2008-09-21 at 09:59 -0700, Ron Bergin wrote: #!/usr/bin/perl # You're missing 2 very important pragmas that should be in every script you write. use warnings; # use strict; # forces you to declare your vars prior to their use. # # Set behaviour $log="/var/

Re: Trying to modify Perl script

2008-09-21 Thread Stephen Reese
John, Thank you and everyone else for the insight to better Perl coding practices in the original script. I have attempted to make the changes that you recommended with negative results. I had a tough time trying to determine what to leave in so before I move on to the new script I would like to f

Re: Trying to modify Perl script

2008-09-21 Thread Jeff Pang
2008/9/22 Stephen Reese <[EMAIL PROTECTED]>: > > $ ./acl-parse.pl > Global symbol "$x" requires explicit package name at ./acl-parse.pl > line 22. > Global symbol "$foo" requires explicit package name at ./acl-parse.pl > line 23. John is right. You should always 'use strict' at the begin of the

Re: Trying to modify Perl script

2008-09-21 Thread Stephen Reese
> John is right. > You should always 'use strict' at the begin of the scripts. > Here you didn't declare the variables, so you got the errors. > You could declare them with: > my $x = ...; > my $foo = ...; > > For Perl's variable scope, see this: > http://perl.plover.com/FAQs/Namespaces.html > Jef

Re: Trying to modify Perl script

2008-09-21 Thread Jeff Pang
2008/9/22 Stephen Reese <[EMAIL PROTECTED]>: >> John is right. >> You should always 'use strict' at the begin of the scripts. >> Here you didn't declare the variables, so you got the errors. >> You could declare them with: >> my $x = ...; >> my $foo = ...; >> >> For Perl's variable scope, see this:

Re: Trying to modify Perl script

2008-09-21 Thread Raymond Wan
Hi Stephen, John is saying that you need to declare them, not initializing them. Declaring them means that you're saying that variable will be used; initializing them means giving them a value. With "use strict", you need to define them before you give them a value...which is a good sanity