Re: the classic "which is the fastest way to sort" question

2009-11-09 Thread Michael Alipio
Hi,   > >  Do you need the fastest possible sort? I'm not even sure if I really need to worry about all these sorting techniques. My program just reads a text file (wordlist). It might be megabyte-sized or probably few gigabytes (i might also add size checking on this to be safe with File::Sl

the classic "which is the fastest way to sort" question

2009-11-09 Thread Michael Alipio
Hi, i'm planning to sort an input file (which was File::Slurp'ed, most likely megabyte-sized file) in various ways. I did some readings and learned several methods that people have come up with in recent years. So to summarize, the default sort is fast (uses quick sort), explicit (using sub) is

must satisfy _unknown_ number of regexp patterns

2009-11-05 Thread Michael Alipio
Hi, if I have a script that accepts any combination of the 5 or maybe even more options, say, option1, option2, option3... Now, after collecting the options, for each option, there is a corresponding regexp pattern. I will then build an if statement, where the test should be, all the options

Re: AW: compact my wordlist generator

2009-10-26 Thread Michael Alipio
: compact my wordlist generator > To: "begginers perl.org" > Cc: "Michael Alipio" > Date: Monday, October 26, 2009, 10:40 PM > Michael Alipio > wrote: > > Can anyone tell me how the code above works? My > original program must > > deal with

Re: compact my wordlist generator

2009-10-26 Thread Michael Alipio
hi, I have this code, mentioned below: my @word = qw(a b c ); my $length = @word; my $char1, $char2, $char3; if ($length == 3){ for ($char1 = 0; $char1<$len;$char1++){ for ($char2 = 0; $char2<$len;$char2++){ for ($char3 = 0; $char3<$len;$char3++){ print "$word[$char1]$word[$char2]$word[$c

split n characters into n chunks

2009-10-25 Thread Michael Alipio
Hi, How do I split a word into n subsets? my $word = "thequickbrown" If I want three subsets I should be able to create: the heq equ upto own Using split function with limit of 3 gives me: t h equickbrown Any idea how to do this? I'm thinking maybe I can just split the whole st

Re: compact my wordlist generator

2009-10-25 Thread Michael Alipio
I was thinking about this recursive thing... thanks for the tip.. will try this out.. I hope I can accomplish it. --- On Sun, 10/25/09, Gabor Szabo wrote: > From: Gabor Szabo > Subject: Re: compact my wordlist generator > To: "Michael Alipio" > Cc: "begginer

compact my wordlist generator

2009-10-25 Thread Michael Alipio
Hi, I'm trying to write a word list generator which can generate all possible combinations of n characters, within n set of characters. So far, this is what I have come up. The only input is the lenght of the password the user wants. my @set = qw(a b c d e f g h i j k l m n o p q r s t

complex split (when delimiter appears in one of the fields)

2009-06-11 Thread Michael Alipio
Hi, I have a string that looks like this: my $string = "1, 3, 0. 0. 0. 0, 22, Zak',adfk $&! mac., "; Basically, there are seven fields. after the bird, everything up to the last comma is the 5th field. 6th field is blank. Now my problem is splitting it and extracting the 5th field. If I wil

2 minutes and 8 second (how do i convert it to 02:08)??

2009-06-11 Thread Michael Alipio
Hi, I have a program that computes the number of elapsed minutes and seconds. if the outputs are: 2 minutes, and 8 seconds. How do I print those two values to look like "Elapsed time: 02:08" Thanks! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
s. Another problem solved!!! Till next time! --- On Wed, 5/27/09, Chas. Owens wrote: > From: Chas. Owens > Subject: Re: variables gets shared to child but resets back after exiting fork > To: "Michael Alipio" > Cc: "begginers perl.org" > Date: Wedn

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
;m reading the perlipc now.. nothing so far.. --- On Wed, 5/27/09, Chas. Owens wrote: > From: Chas. Owens > Subject: Re: variables gets shared to child but resets back after exiting fork > To: "Michael Alipio" > Cc: "begginers perl.org" > Date: Wednesday, May 2

variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
Hi, I have to run an external program but the program does not termination on some conditions, e.g, ping, will not exit unless you specify -c or some other circumstances. Now I what I want to do is: my @array; die "Cannot fork myprog" unless (defined my $pid = fork) if ($pid==0){ open MYPROG

script to control web browser (enter captcha text manually)

2009-05-23 Thread Michael Alipio
Hi, I need to register a few accounts on a website that uses captcha. It's just a few accounts but it's a very daunting task because there are so many fields to fill up. Is there a way I can do this in perl? What I want is that my script will fire up the browser, access that particular registr

Re: two nested hashes, one subroutine, after calling, my second hash disappears

2009-05-21 Thread Michael Alipio
Hi, > >      >    $$postdata{'login:command/username'} = > ($username eq '')?'':$username; > > $$postdata{'login:command/username'} is usually written as > $postdata->{'login:command/username'}.  You compare > $username to '' and if it is equal to '' then you return '' > and if it is not equal

two nested hashes, one subroutine, after calling, my second hash disappears

2009-05-21 Thread Michael Alipio
Hi, I thought I had it all figured out. Hash within hashes really made my code cleaner until I came up with this code: While looping, I was creating a key 'webloginpostdata' with value of anonymous hash as seen below; $all_ap{$_}->{'webloginpostdata'} = {

How does printf able to receive a pointer when passing it a string constant?

2009-05-13 Thread Michael Alipio
I have a c code that looks like this: #include main (){ char girl[] = "anna"; char boy[] = "jude"; stringcopy(boy, girl); /* copy boy to girl */ printf("%s", girl); } void stringcopy(char *b, char *g){ while ((*g++ = *b++) != '\0') ; } It prints fine... However if I replace the stringcopy

Cross compiling to mipsel

2009-05-12 Thread Michael Alipio
Hi, I've searched the web and didn't find anything useful. Is there anyway to cross compile my perl code to mipsel? or do i have to learn C?? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Controlling screen output. Print something then afterwards replace it

2009-04-22 Thread Michael Alipio
Hi, Is it possible to print something and then replace what you have printed with a different value? Say I have a program that watches a logfile and prints the current number of lines. after sleeping for n seconds, it will print the number of lines again. But i don't want to print it below t

sleep exactly after n seconds (sleep finishing longer than specified)

2009-04-22 Thread Michael Alipio
Hi, I have a script that forks a child. at the parent, i have a line that tells it to sleep for n seconds. Once the 3 seconds have passed, it will kill the child process. I noticed that most of the time, sleep doesn't count exact seconds.. most of the time it's longer. Is there any way to sle

trouble with nested forks() (keep spawning twin process)

2009-04-16 Thread Michael Alipio
Hi, I have this code: die "Could not fork command1!" unless defined (my $command1_pid = fork); if ($command1_pid == 0){ open EXTERNAL_PROG1, "external_prog1 |" or die "Can't run external_prog1"; while (){ if (/pattern/){ die "Could not fork command2" unless defined (my $command2_p

Re: Turn off $ anchor greedy behavior

2009-04-14 Thread Michael Alipio
Aha, found it.. The split returned a list and you've just sliced it. giving [-1] means the list will start running through the elements backwards. --- On Tue, 4/14/09, Michael Alipio wrote: > From: Michael Alipio > Subject: Re: Turn off $ anchor greedy behavior > To: &

Re: Turn off $ anchor greedy behavior

2009-04-14 Thread Michael Alipio
> > Or use split and return the last field: > > $ perl -le' > my $string = "boy, pig, 123, 123:412adbd, d0g, > lajdlf134><<_ lkadsf !234,\n"; > my $value = ( split /,\s+/, $string )[ -1 ]; Another mind bogling example... :-) I thought I would do: my @value = ( split /,\s+/, $string ); print $

Re: AW: Turn off $ anchor greedy behavior

2009-04-14 Thread Michael Alipio
> my $string = 'boy, pig, 123, 123:412adbd, d0g, > lajdlf134><<_ lkadsf !234,'; > > if( $string =~ m/,\s*([^,]*),[^,]*$/ ){ > print "$1\n"; > } How could you guys write this so simple? My regexp was twice this long. the regexp after \s* tells perl to match anything (0 or more) that is not a

Turn off $ anchor greedy behavior

2009-04-14 Thread Michael Alipio
Hi, I have a $string that is separated by , and space; boy, pig, 123, 123:412adbd, d0g, lajdlf134><<_ lkadsf !234, Now I want to capture the string(s) between last two commas. It consists of anything upto 32 characters. that is, right after d0g,\s+ up to the last character before the last c

Re: killing a forked process (external programs always detach from child process)

2009-04-13 Thread Michael Alipio
so that when i kill the child, the external program will die. Is there a way to capture the PID of the external program? I tried using "open" to launch it but open quickly exits the program after assigning it to a variable, e.g my $extern_pid = open TOP, "top |" or di

killing a forked process

2009-04-13 Thread Michael Alipio
Hi, My program looks like this: my $pid = fork (); if ($pid == 0){ exec ("top"); }else{ my $time = 0 while (<1>){ sleep 1; $time++; if ($time == 10){ kill 9, $pid; } } } That is, after running the forked "top" process for 10 seconds, the main program w

Re: catching outputs of realtime apps (e.g; 'top(8)'

2009-04-12 Thread Michael Alipio
to parse it. thanks. --- On Mon, 4/13/09, Chas. Owens wrote: > From: Chas. Owens > Subject: Re: catching outputs of realtime apps (e.g; 'top(8)' > To: daem0n...@yahoo.com > Cc: beginners@perl.org > Date: Monday, April 13, 2009, 7:40 AM > On Sun, Apr 12, 2009 at 17:02,

Re: catching outputs of realtime apps (e.g; 'top(8)'

2009-04-12 Thread Michael Alipio
e top? --- On Mon, 4/13/09, Chas. Owens wrote: > From: Chas. Owens > Subject: Re: catching outputs of realtime apps (e.g; 'top(8)' > To: daem0n...@yahoo.com > Cc: beginners@perl.org > Date: Monday, April 13, 2009, 2:28 AM > On Sun, Apr 12, 2009 at 14:14, Michael Alipio >

catching outputs of realtime apps (e.g; 'top(8)'

2009-04-12 Thread Michael Alipio
Hi, I have a program that constantly displays values on the screen. The program 'ping' for example. What I'd like to do is watch the output and as soon as i see some values, i would do something. For example, as suppose when pinging a host I would constantly get a reply. however, if I remove

Break out of the sub or loop on keypress

2008-08-09 Thread Michael Alipio
Hi, I have a sub that returns a value and inside it runs a loop that displays something on the screen, say a list of numbered items. Now what I want to do is if the item i'm interested appears on the screen, the user can hit any key and the program will exit the sub and return what ever it is s

ASP with VIEWSTATE and perl

2008-01-17 Thread Michael Alipio
Hi, Quick question: Anyone here knows a module which can handle viewstate in asp html forms?? I need to write a script that can submit a form to the server that is using viewstate.. thanks. Looking fo

Re: Password generator (limit my dictionary to...)

2007-10-22 Thread Michael Alipio
osition, it must have at least 4 letters and 2 numbers and of course it should fall between 6 to 15 characters. In the meantime, let me look at your solution... --- Paul Lalli <[EMAIL PROTECTED]> wrote: > On Oct 22, 2:45 am, [EMAIL PROTECTED] (Michael > Alipio) wrote: > >

Password generator (limit my dictionary to...)

2007-10-21 Thread Michael Alipio
Hi, I'm trying to create a dictionary file for my bruteforce program. I have a huge dictionary file and I want to trim it down according the requirements. The output should be a dictionary file that is minimum 6 characters and maximum 15 characters with at least 4 letters and 2 numbers in it..

confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])

2007-01-29 Thread Michael Alipio
Hi, I have a file that look like this: 1668 | 172.194.177.182 | US12679172 10396 | 64.237.148.157 | PR 12679172 9318 | 211.187.212.242 | KR1279172 22291 | 66.215.254.186 | US 1269172 22291 | 24.176.212.76 | US 1679172 30225 | 66.147

Re: trouble with list context assignment for substitution inside File::Find &wanted function

2007-01-23 Thread Michael Alipio
- Original Message From: John W. Krahn <[EMAIL PROTECTED]> To: Perl Beginners Sent: Wednesday, January 24, 2007 10:57:51 AM Subject: Re: trouble with list context assignment for substitution inside File::Find &wanted function > Yes, the substitution operator (s///) returns true (1)

trouble with list context assignment for substitution inside File::Find &wanted function

2007-01-23 Thread Michael Alipio
Hi, I have a directory which contains several files. client1-2006-05-19.log.gz client1-2006-05-20.log.gz client1-2006-07-29.log.gz client1-2006-10-05.log.gz client1-2006-05-21.log.gz I want strip all of "axisglobal-" in their filenames. What I did was: #!/usr/bin/perl use warnings; use s

Trouble appending into gzipped file using Compress::Zlib (Re: compressing files into tar.gz (which module do you prefer)

2007-01-21 Thread Michael Alipio
Hi, - Original Message From: Rob Dixon <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]> Cc: beginners@perl.org Sent: Monday, January 22, 2007 10:46:40 AM Subject: Re: compressing files into tar.gz (which module do you prefer) Michael Alipio wrote: > Hi, >

compressing files into tar.gz (which module do you prefer)

2007-01-21 Thread Michael Alipio
Hi, After parsing a log and writing it into a file, I now, have to compress it into tar.gz. Right now, I'm doing a search at CPAN and there where too many modules out there with "compress" or "archive" search keyword. What do you suggest? Thanks __

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Michael Alipio
- Original Message From: Ovid <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Sunday, January 21, 2007 10:26:20 PM Subject: Re: putting ";" as a replacement in the substitution. --- Michael Alipio <[EMAIL PROTECTED]> wrote: > No, not correct. The reg

Re: putting ";" as a replacement in the substitution.

2007-01-21 Thread Michael Alipio
- Original Message From: D. Bolliger <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Sunday, January 21, 2007 7:43:19 PM Subject: Re: putting ";" as a replacement in the substitution. > Because everything matched - that is: vd=\w+(,) - is replaced with the > semicolon. > You seem to

Re: Regexp in lookup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.)

2007-01-21 Thread Michael Alipio
- Original Message From: Michael Alipio <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: begginers perl.org Sent: Sunday, January 21, 2007 7:11:47 PM Subject: Regexp in loopup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.)

Regexp in loopup differs in regexp in substitution (Re: putting ";" as a replacement in the substitution.)

2007-01-21 Thread Michael Alipio
- Original Message From: Ovid <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]> Sent: Sunday, January 21, 2007 4:49:41 PM Subject: Re: putting ";" as a replacement in the substitution. --- Michael Alipio <[EMAIL PROTECTED]> wrote: > Hi, &g

Re: putting ";" as a replacement in the substitution.

2007-01-20 Thread Michael Alipio
- Original Message From: Bill Jones <[EMAIL PROTECTED]> To: begginers perl.org Sent: Sunday, January 21, 2007 1:03:33 PM Subject: Re: putting ";" as a replacement in the substitution. On 1/20/07, Michael Alipio <[EMAIL PROTECTED]> wrote: > > my $string

putting ";" as a replacement in the substitution.

2007-01-20 Thread Michael Alipio
Hi, #I have this string: my $string = 'vd=root,status='; #Now, I want to transform it into: 'vd=root;status=' #That is replace the comma(,) between root and status with semicolon (;); $string =~ s/vd=\w+(,)/;/; print $string,"\n"; #And it prints: ;status= Can you tell me why it has ate up

Re: Alternative lookaheads in substitution, is it possible? (SOLVED!!!)

2007-01-20 Thread Michael Alipio
e to RTFM.. :-) More power to this helpful commmunity!! - Original Message From: Michael Alipio <[EMAIL PROTECTED]> To: begginers perl.org Sent: Saturday, January 20, 2007 7:21:17 PM Subject: Alternative lookaheads in substitution, is it possible? Hi, Suppose I want to match

Alternative lookaheads in substitution, is it possible?

2007-01-20 Thread Michael Alipio
Hi, Suppose I want to match all white spaces if it is followed by "\w+=" or not followed by "date or time" : $_ =~ s(/\s+(?=\w+=)/ || /\s+(?!(date|time)))/*/g; Doesn't seem to do what I want. Given a string: "Jan 19 11:37:21 firewall date=2007-01-19 time=11:42:15 msg="User admin login" I wa

character classes vs regexp alternatives (using "( )" or "[ ]"

2007-01-19 Thread Michael Alipio
Hi, I'm a bit confused here: I have a regexp: ($date) = $log =~ /date=(\S+?)[\s+|,]/; so if I have: "date=2007-01-12 blah blah" or "date=2007-01-12,blah,blah" I was able to retrieve "2007-01-12" However, just recently after reading my notes on perl, I read that I should use parenthes

Re: Selective splits... (treat this "pattern" as a delimiter only if it is followed by this "pattern")

2007-01-19 Thread Michael Alipio
l times but I failed. Thanks. > cheers, > ~i On 1/19/07, Michael Alipio <[EMAIL PROTECTED]> wrote: > Hi, > > Suppose I have: > > > my $string = 'Jan 19 11:37:21 firewall date=2007-01-19 time=11:42:15 > devname=TESTfirewall device_id=FGT-602905503304 log_id=01040

Selective splits... (treat this "pattern" as a delimiter only if it is followed by this "pattern")

2007-01-19 Thread Michael Alipio
Hi, Suppose I have: my $string = 'Jan 19 11:37:21 firewall date=2007-01-19 time=11:42:15 devname=TESTfirewall device_id=FGT-602905503304 log_id=0104032006 ty pe=event subtype=admin pri=information vd=root user="admin" ui=GUI(192.168.1.1) action=login status=success reason=none msg ="User admin

Re: Searching hash if a given value exists

2007-01-19 Thread Michael Alipio
Hi, > - Original Message > From: Igor Sutton <[EMAIL PROTECTED]> > To: Mumia W. <[EMAIL PROTECTED]> > Cc: Beginners List > Sent: Friday, January 19, 2007 4:42:09 PM > Subject: Re: Searching hash if a given value exists > [...] > New benchmarks about the subject: > foreach_has

choosing which to join in a given string.

2007-01-19 Thread Michael Alipio
Hi, my $string = "This is a sentence"; Now, I want to join "is" and "a" by a dash. Any idea how do i do that? using regexp may not be want I want because the real string contains many words, so I have to join several words without using too much regexp substitutions. Thanks. __

substitute all spaces in a sentence except spaces in the first three words

2007-01-19 Thread Michael Alipio
Hi, Suppose I have: my $sentence = 'the quick brown fox jumps over the lazy dog." Now I want it to become: 'the quick brown:fox:jumps:over:the lazy dog." That is, to replace the spaces between brown-fox, fox-jumps, jumps-over, over-the, with ":". Should I split the sentence and put each in a

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: 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 k

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{$_

Passing hash into sub routines (should i use reference?)

2007-01-17 Thread Michael Alipio
Hi, Suppose I have this code: #/usr/local/bin/perl use warnings; use strict; use subs 'verify'; my %where=( Gary => "Dallas", Lucy => "Exeter", Ian => "Reading", Samantha => "Oregon" ); # Then i open a logfile open FH, '<', $logfile or die "Can't open $logfile!:

Re: Hash variable is not imported?? (Re: Storing File Handles for writing)

2007-01-16 Thread Michael Alipio
Hi John! - Original Message > From: John W. Krahn <[EMAIL PROTECTED]> > To: Perl Beginners > Sent: Tuesday, January 16, 2007 8:15:36 AM > Subject: Re: Hash variable is not imported?? (Re: Storing File Handles for > writing) > > > > open( LOGFILE, '<', $logfile ) or die "Can't open $l

Hash variable is not imported?? (Re: Storing File Handles for writing)

2007-01-16 Thread Michael Alipio
Hi Mumia, I think this one is closer to my goal. #!/usr/local/bin/perl use warnings; use strict; my $logfile='fortilog'; my $devicefile='deviceid'; our %clientdevice; open DEVICES, '<', $devicefile or die "Can't open $devicefile $!"; while (){ (my $client) = $_ =~ /^(\S+\s+)/; (my $device)

Re: Storing filehandles(for writing) in hashes doesn't work (Re: whilereach my $variable () )

2007-01-16 Thread Michael Alipio
D]> To: Beginners List Sent: Tuesday, January 16, 2007 3:13:38 PM Subject: Re: Storing filehandles(for writing) in hashes doesn't work (Re: whilereach my $variable () ) On 01/15/2007 11:21 PM, Michael Alipio wrote: > Hi, > > Ok, seems like a "pet logs" is not a good example

Storing filehandles(for writing) in hashes doesn't work (Re: whilereach my $variable () )

2007-01-15 Thread Michael Alipio
r before $line?) syntax error at extractdevice.pl line 35, near "} $line" If I comment those codes inside the while in that second part, the program will successfully create emtpy "device_id1.log, device_id2.log, etc. etc.) Any idea what's wrong with this one? - Origi

whilereach my $variable () ???? (sort of like foreach my $variable (@array)

2007-01-15 Thread Michael Alipio
Hi, I've been thinking about this for quite some time now. Suppose I have a text file ("mypet.log" that contains: dog pig cat Then I have another text file and I want to read it line by line and extract each line that has those contained in the first file. Sort of like running while inside whi

How can I list down all builtin functions?(Re: Read a text file starting from the bottom)

2007-01-14 Thread Michael Alipio
Hi, Is there a way to list down all builtin functions so that I may know what to "perldoc -f"? Thanks. - Original Message ---- From: Michael Alipio <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Monday, January 15, 2007 1:44:22 PM Subject: Read a text file starting fro

Read a text file starting from the bottom

2007-01-14 Thread Michael Alipio
Hi, I wanted to extract the start time of a particular logfile (located at the beginning of the file, and also the end time which is located at the end of the logfile. Is there any way to do this in perl without using "head" or "tail" commands? Thanks. By the way, can you point me somewhere p

create symlinks to thousands of files using perl

2007-01-03 Thread Michael Alipio
I have a folder named "myfolder" Inside "myfolder", I have several files named "ft1, ft2, ft3, ft4". I need to create symbolic links to all of those files into my current working directory. I tried creating a shell script: #!/bin/sh for i in /myfolder/ft* ; do ln -s ${i} ./; done But what it d

Aggregating repeating lines

2006-12-05 Thread Michael Alipio
Hi, I have a long log file that looks like this: 7491| 210.23.185.123 | PH202597706 7491| 210.23.169.91| PH202594221 7303| 201.252.130.245 | AR201955854 9318| 210.205.6.225| KR201892149 9930| 210.19.229.57| MY201418551 9600| 210.251.253.1

Re: Ok, this time Net::SSH2 question :-) (pls ignore )

2006-10-30 Thread Michael Alipio
- Original Message From: Michael Alipio <[EMAIL PROTECTED]> To: Michael Alipio <[EMAIL PROTECTED]>; beginners perl Sent: Monday, October 30, 2006 1:25:36 PM Subject: Re: Ok, this time Net::SSH2 question :-) Hi, Do you know if I still need to do something to enable Net::

Re: Ok, this time Net::SSH2 question :-)

2006-10-29 Thread Michael Alipio
codes shipped in distribution is useful and works.. I guess I must stick with Net::SSH::Perl.. - Original Message From: Michael Alipio <[EMAIL PROTECTED]> To: beginners perl Sent: Monday, October 30, 2006 10:49:18 AM Subject: Ok, this time Net::SSH2 question :-) Hi, After r

Ok, this time Net::SSH2 question :-)

2006-10-29 Thread Michael Alipio
Hi, After reading the docs, I ended up with these lines: #!/usr/local/bin/perl use warnings; use strict; use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->method('HOSTKEY', 'ssh-rsa'); $ssh2->connect('192.168.1.1') or die; $ssh2->auth_publickey ('admin', '/root/.ssh/id_rsa.pub', '/root/.ssh/id

Quick Net::SSH::Perl question

2006-10-27 Thread Michael Alipio
Hi, My program looks like this: #!/usr/local/bin/perl use warnings; use strict; use Net::SSH::Perl; my $host = '192.168.1.1'; my $user = 'user'; my $pass = 'password'; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); $ssh->shell; It spawns a shell successfully but takes too lon

Re: Help, using script to edit router config (entering different modes automatically)

2006-10-27 Thread Michael Alipio
- Original Message From: Bjørge Solli <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Friday, October 27, 2006 3:32:06 PM Subject: Re: Help, using script to edit router config (entering different modes automatically) Tried Net::SSH::Perl? http://search.cpan.org/~dbrobins/Net-SSH-Perl

Can't access search.cpan.org

2006-10-27 Thread Michael Alipio
Hi, As of 3:43:18 pm here in Manila, Philippines, I can't access search.cpan.org.. Any idea why?

Help, using script to edit router config (entering different modes automatically)

2006-10-27 Thread Michael Alipio
Hi, Suppose I have an appliance, it's not cisco but the process of updating configuration is almost the same. 1. First you log-in either via ssh or telnet.. 2. Then you go into a certain mode by typing a particular command. 3. Only after you have enter that mode, you can issue the actual editing

regexp inside hashes

2006-10-03 Thread Michael Alipio
Hi, There was this example given to me: while ( ) { my %extr = ( Start => '', IP=> '', User => '', End => '', /^(Start|IP|User|End)=(.+)/mg ); print "Start:$extr{Start} IP:$extr{IP} User:$extr{User} End:$extr{End}\n\n"; } Readin

IO::Scalar Help

2006-10-03 Thread Michael Alipio
My Log file looks like this: Each session contains at most four lines and then it is separated by newline. I need to grab each session and put each key/value pair in hash. Start=2006-10-03.09:09:51 IP=192.168.0.14 User=alex End=2006-10-03.09:14:10 Start=2006-10-03.09:52:12 IP=192.168.0.15 End=

Regexp Basics

2006-10-02 Thread Michael Alipio
Hi, Suppose I have this: #!/usr/local/bin/perl use strict; my $string = "Theres more than 1 way to do it"; if ($string =~ /\w+$/){ print "Hooray! pattern found"; print $1; } My goal is to print the last word. However, it only prints "Hooray! pattern found"; Any idea what's wrong with $1?? Tha

one liner to remove \xa0 characters

2006-09-25 Thread Michael Alipio
Hi, I have several files with \xa0 characters.. Do you know how can I remove them? Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

running through regexp matches ($1-$n)

2006-09-15 Thread Michael Alipio
Hi, A log file contains several of these lines: session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blablabla blablabla srcport:3243 blablabla dstport:23 blablabla session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blablabla blablabla srcport:3243 blablabla dstport:2

extracting several text from logs using regex

2006-09-14 Thread Michael Alipio
Hi, A log file contains several of these lines: session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blablabla blablabla srcport:3243 blablabla dstport:23 blablabla session.blablahbla blablabla proto:6 blablabla srcip:90.0.0.1 blablabla blablabla srcport:3243 blablabla dstport:2

Re: looping through complicated hashes..

2006-09-07 Thread Michael Alipio
ignore this one.. I've already figured out how. thanks. --- Michael Alipio <[EMAIL PROTECTED]> wrote: > Hi, > > I have an input file with 7 columns each line. Words > are separated with 1 or more spaces.. > Now, I want each of these lines placed into > HTML::Table

looping through complicated hashes..

2006-09-07 Thread Michael Alipio
Hi, I have an input file with 7 columns each line. Words are separated with 1 or more spaces.. Now, I want each of these lines placed into HTML::Table's rows. The HTML::Table has something like this. each row (with 7 cells) is encolsed with []. I want each row, populated with each line in my inpu

arithmetic expression while substituting

2006-09-06 Thread Michael Alipio
Hi, Suppose I have the output of this command date +%d.%H which outputs: 06.11 I want to adjust the last two digits to less 1: such that it becomes 06.10.. how do I do that? perhaps something like this. s/\d+$/(regexp being lookup minus 1/ thanks! ___

can't print to STDOUT on 5.8.4

2006-09-04 Thread Michael Alipio
Hi, I was running this command on my perl program, open FLOWTOOLS, "|/usr/bin/flow-cat $start | /usr/bin/flow-nfilter -f filter.tmp -F $direction |/usr/bin/flow-stat -Pf8 | le ss" or die $!; It does output something on the screen when I run it on FreeBSD 6.1/perl 5.8.8 (while on csh) However, w