regular expression

2007-05-07 Thread Sarthak Patnaik
Hi All, Hope you all had a great weekend. I have a file: Text.txt One Match Not Two Match Three Four --- Now I want to get only the line that has Match and not the line Match Not. I used : cat text.txt | perl -nle 'print $_ if (/Match/)(!/Match Not/)'

Re: regular expression

2007-05-07 Thread Jeff Pang
Now I want to get only the line that has Match and not the line Match Not. I used : cat text.txt | perl -nle 'print $_ if (/Match/)(!/Match Not/)' But I want to do that inside one regular expression. Hello, perl -nle 'print $_ if /Match(?!\s+Not)/' -- Chinese Practical Mod_perl book

Perl-package with C-Files

2007-05-07 Thread Rene Schickbauer
Hi! I'm wondering if you could point me to some easy step-by-step tutorial for the following problem (i got tons of tuts on google, none of them really helped me) Backgroung: I've written a pseudo-filesystem in C for my game (BlinkenSisters). As the planned level editor is going to be Perl/TK, i

Re: regular expression

2007-05-07 Thread Rob Dixon
Sarthak Patnaik wrote: I have a file: Text.txt One Match Not Two Match Three Four --- Now I want to get only the line that has Match and not the line Match Not. I used : cat text.txt | perl -nle 'print $_ if (/Match/)(!/Match Not/)' But I want to do that inside one regular

array and hash patter matching

2007-05-07 Thread Tim Wolak
Morning all, I am working on a script that reads in /var/log/auth.log,, takes the ip addresses puts them into a hash keeping track of how many times it finds that address and compare it to addresses found in /etc/hosts.deny and only write the addresses that are new in the file. So far I can get

Re: array and hash patter matching

2007-05-07 Thread Tom Phoenix
On 5/7/07, Tim Wolak [EMAIL PROTECTED] wrote: however I am struggling on how to compare the hash with an array for any duplicate addresses. What is the best approach to take with this? You want to know whether a given IP address matches any of a list of IP addresses, right? Probably I'd use

Diff on a database structure

2007-05-07 Thread Nigel Peck
Hi, When I'm developing web applications I have a dev version of the scripts, modules and database and a live version. Nothing new there. I'm trying to automate the process of moving the dev site to the live site (the dev sites are on a Fedora server on my desk and the live sites on a

Re: Diff on a database structure

2007-05-07 Thread leslie . polzer
On Mon, May 07, 2007 at 05:13:12PM +0100, Nigel Peck wrote: I'd like to find a way of comparing the two MySQL database strcutures and getting a list of the differences, anyone know of any modules/methods for doing this? I don't know about something Perl-specific, but I guess what you want is

Re: Diff on a database structure

2007-05-07 Thread Nigel Peck
Hi Jen, Thanks for your suggestion, I don't have a master build script, I do it be hand through phpMyAdmin and then use the backup feature of that if I want to move it. I'm really looking for something that I can say to: compare this database with this one and tell me what the differences

Re: array and hash patter matching

2007-05-07 Thread John W. Krahn
Tim Wolak wrote: Morning all, Hello, I am working on a script that reads in /var/log/auth.log,, takes the ip addresses puts them into a hash keeping track of how many times it finds that address and compare it to addresses found in /etc/hosts.deny and only write the addresses that are new

Re: Diff on a database structure

2007-05-07 Thread Rene Schickbauer
Hi! I'd like to find a way of comparing the two MySQL database strcutures and getting a list of the differences, anyone know of any modules/methods for doing this? Here's more or less what some commercial tools do: **pseudocode start** get all lines, split them into a datastructure like

Re: array and hash patter matching

2007-05-07 Thread Rene Schickbauer
Morning all, I am working on a script that reads in /var/log/auth.log,, takes the ip addresses puts them into a hash keeping track of how many times it finds that address and compare it to addresses found in /etc/hosts.deny and only write the addresses that are new in the file. So far I

looping through a file

2007-05-07 Thread Robert Hicks
I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find the line that the id is on, I need the next line

Redirecting STDOUT STDERR

2007-05-07 Thread Karyn Williams
I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it works, however it generates a warning when running my script. I

Re: Redirecting STDOUT STDERR

2007-05-07 Thread Adriano Ferreira
On 5/7/07, Karyn Williams [EMAIL PROTECTED] wrote: I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it works,

Re: Redirecting STDOUT STDERR

2007-05-07 Thread Tom Phoenix
On 5/7/07, Karyn Williams [EMAIL PROTECTED] wrote: I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it works,

Re: Diff on a database structure

2007-05-07 Thread David Van Ginneken
This may work for you: http://www.adamspiers.org/computing/mysqldiff/ http://search.cpan.org/~aspiers/MySQL-Diff-0.33/ I tried it comparing 2 test databases here and it appears to work. On 5/7/07, Nigel Peck [EMAIL PROTECTED] wrote: Hi, When I'm developing web applications I have a dev

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find

Modeling for Tk

2007-05-07 Thread Moon, John
Does any one have suggestions how to model - give the end user - views of the windows and navigation of a Perl Tk application? John W Moon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

complex sort

2007-05-07 Thread Nisse Tuta
Hi All, I am having big problems solving this sorting issue and would really appreciate any help on this. I have a list with each row containing 3 numbers(Run In Out). For example, R01 13 19 R01 25 30 R01 23 47 R01 2 14 R02 2 45 R02 55 60 R01 1 17 R03 45 66 R03 20 35 and so on.. I would

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this

Re: complex sort

2007-05-07 Thread Tom Phoenix
On 5/7/07, Nisse Tuta [EMAIL PROTECTED] wrote: I would like to go through these and check for any overlapping numbers at both In and Out and replacing either the in out or both if overlapped. And any cuts/breaks in each run will add a count. I'd like more information on what you're trying to

Re: complex sort

2007-05-07 Thread yitzle
I don't understand what you want to do with duplicates. The example input and output don't seem to match. You likely want to use a hash. You can do something like this (untested code): my %hash; foreach (@array) { my ($run, $in, $out) = split / /; # Split the array element by spaces # Count

Re: Diff on a database structure

2007-05-07 Thread Nigel Peck
David Van Ginneken wrote: This may work for you: http://www.adamspiers.org/computing/mysqldiff/ http://search.cpan.org/~aspiers/MySQL-Diff-0.33/ http://search.cpan.org/~aspiers/MySQL-Diff-0.33/ I tried it comparing 2 test databases here and it appears to work. Looks like exactly what I'm

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as well. snip

Re: Redirecting STDOUT STDERR

2007-05-07 Thread John W. Krahn
Karyn Williams wrote: I have this script I have been working on where I need to redirect STDOUT and STDERR to files at the beginning of the script and then back to default (terminal) at the end of the script. I found an example on-line and used it and it works, however it generates a warning

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as