Re: recursive replace

2004-06-16 Thread George Georgalis
On Mon, Jun 14, 2004 at 04:42:40PM -0500, JupiterHost.Net wrote: > > >George Georgalis wrote: > >>In my perl notes I found this for recursive replace >> >>I want to replace all instances of oldstring with newstring in html >>files, ./ and below. >> >> perl -i -e 's/oldstring/newstring/g;' $( fi

Re: recursive replace

2004-06-16 Thread Randy W. Sims
George Georgalis wrote: On Mon, Jun 14, 2004 at 04:42:40PM -0500, JupiterHost.Net wrote: George Georgalis wrote: In my perl notes I found this for recursive replace I want to replace all instances of oldstring with newstring in html files, ./ and below. perl -i -e 's/oldstring/newstring/g;' $(

Pattern matching line by line

2004-06-16 Thread bzzt
I'm trying to match a patern in a string but I want to do it a line at a time. Is there an easier way than this : while ($a =~ m/(.+?)\n/g ) { if ($1 =~ /whatever/g) { print "$1"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Pattern matching line by line

2004-06-16 Thread Marcos . Rebelo
why not to split the String first something like foreach my $line (split(/\n/, $a)) { if ($line =~ /whatever/) { print $line; } } shall do the trick Marcos > -Original Message- > From: bzzt [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 16, 2004 1:33 PM > To: [EMAIL PROT

Re: Pattern matching line by line

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, bzzt said: >I'm trying to match a patern in a string but I want to do it a line at a >time. Is there an easier way than this : >while ($a =~ m/(.+?)\n/g ) { > if ($1 =~ /whatever/g) { >print "$1"; > } Your regex, /(.+?)\n/, is unnecessarily complex. The ? modifier on .+ isn't

Helpful Regular Expression Tool

2004-06-16 Thread Ciemny, Jessica
I am not sure if anyone has ever mentioned this before, but I wanted to share something with you that I have recently found that might be of great assistance with many of your "RegEx" issues. The name of this program is, "The Regex Coach". I have found it to be an invaluable tool to any regular e

RE: Helpful Regular Expression Tool

2004-06-16 Thread Roberts Mr Richard L
URL? thanks in advance Richard L. Roberts Systems Integrator Marine Corps Community Services 3044 Catlin Ave. Quantico, Va. 22134 Phone: 703.432.0109 Fax: 703.784.1249 Email: [EMAIL PROTECTED] -Original Message- From: Ciemny, Jessica [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16,

Counting help

2004-06-16 Thread rmck
Im trying to list a record once and then count how many records. But I keep getting a list of all the records and it counts those?? I read in a file with a list of rooms and then look for each one that matches dept 22 and Im trying to show it once and then count how many for the building? #!/u

Re: Link refresh

2004-06-16 Thread JupiterHost.Net
Werner Otto wrote: Thanks, it works like a charm! np :) Perl rocks! Lee.M - JupiterHost.Net On Tue, 15 Jun 2004 14:35:58 -0500, JupiterHost.Net <[EMAIL PROTECTED]> wrote: Werner Otto wrote: Sorry this might be off the topic. Is there anything that I can do in perl to: when I click on a link to

Re: Counting help

2004-06-16 Thread Wiggins d Anconia
> Im trying to list a record once and then count how many records. But I keep getting a list of all the records and it counts those?? I read in a file with a list of rooms and then look for each one that matches dept 22 and Im trying to show it once and then count how many for the building? > > >

Date and time calculation

2004-06-16 Thread Werner Otto
Hi there, I've got a date field and a time field, how can I effectively subtract the field ($date $time) - ($date2 $time2) from each other. I am using these two fields to determine a server's uptime according to my database in days,hours,minutes,seconds. I have read numourous articles and posts

Re: Date and time calculation

2004-06-16 Thread Wiggins d Anconia
> Hi there, > > I've got a date field and a time field, how can I effectively subtract the > field ($date $time) - ($date2 $time2) from each other. I am using these > two fields to determine a server's uptime according to my database in > days,hours,minutes,seconds. I have read numourous articl

RE: Helpful Regular Expression Tool

2004-06-16 Thread NYIMI Jose (BMB)
> -Original Message- > From: Roberts Mr Richard L [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 16, 2004 2:55 PM > To: 'Ciemny, Jessica'; [EMAIL PROTECTED] > Subject: RE: Helpful Regular Expression Tool > > > URL? Google :-) http://www.google.be/search?q=Regex+Coach&ie=UTF-8&hl=nl

Re: Counting help

2004-06-16 Thread rmck
Thanks for the response. That was a mistake with the variables twice. The counter was moved in to the while loop. The first argument to bind_columns( ) is an undef, due to historical reasons. It's no longer required if you are using DBI 1.08 or later. Without it I get errors. I was tring

Creating a format for a table of data

2004-06-16 Thread jason corbett
I need to create headers that I can use when querying data from the database. It seems that I am not making the right code because it hasn't shown up in my file, but I also don't get any errors. Can some look at the code and tell me where I am going wrong? thanks JC #Connecting to the databa

Re: Date and time calculation

2004-06-16 Thread Werner Otto
According to perldoc. Date_to_Time: $time = Date_to_Time($year,$month,$day, $hour,$min,$sec); Here I can go print $time and get the value Time_to_Date: ($year,$month,$day, $hour,$min,$sec) = Time_to_Date([time]); How do I see the value converted back to the date as it was? Hi there, I've got

RE: Counting help

2004-06-16 Thread Traeder, Philipp
[..] > I will try and explain again what I am trying to do. > I read in a file with a list of > roomsThen im trying to list the room once and then count > how many records match for the select statement and only > print the building once with a count in front of it.. > > db: > date build

RE: Counting help

2004-06-16 Thread Wiggins d Anconia
> [..] > > I will try and explain again what I am trying to do. > > I read in a file with a list of > > roomsThen im trying to list the room once and then count > > how many records match for the select statement and only > > print the building once with a count in front of it.. > > > >

Re: Date and time calculation

2004-06-16 Thread Wiggins d Anconia
> According to perldoc. > > Date_to_Time: > $time = Date_to_Time($year,$month,$day, $hour,$min,$sec); > > Here I can go print $time and get the value > > Time_to_Date: > ($year,$month,$day, $hour,$min,$sec) = Time_to_Date([time]); > > How do I see the value converted back to the dat

a simple question

2004-06-16 Thread Kevin Zhang
Thanks in advance for your kind help. For the following string: " axyzb cxyzd " What is the command to extract the substrings with "xyz" in them? In this case, I'd like to get two strings "axyzb" and "cxyzd". - Do you Yahoo!? Y

Identifying words containing a specific substring in a sentence (was: a simple question)

2004-06-16 Thread David Dorward
Tip: This is a beginners list, therefore many questions will be simple. Aim for more descriptive subject lines and life will be easier for users of the list archives. On 16 Jun 2004, at 17:10, Kevin Zhang wrote: For the following string: " axyzb cxyzd " What is the command to extrac

Re: a simple question

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, Kevin Zhang said: >For the following string: > >" axyzb cxyzd " > >What is the command to extract the substrings with "xyz" in them? In this >case, I'd like to get two strings "axyzb" and "cxyzd". Well, you could do: my @matches = grep /xyz/, split ' ', $string; Let me

Re: Identifying words containing a specific substring in a sentence (was: a simple question)

2004-06-16 Thread Kevin Zhang
Thank you so much (and for the tip too). It works great! One more question, how do I strip out all letters before "xyz". For the original example, how would I get "xyzb" and "xyzd"? Thanks again, Kevin David Dorward <[EMAIL PROTECTED]> wrote: Tip: This is a beginners list, therefore many que

printing first 40 lines in one string

2004-06-16 Thread DBSMITH
All, was hoping for some advice. :) I have a file that looks like this: e4343 d3434 34344 43434 de434 and I am printing the first 40 lines using $foo = qw(my/file/with/40+lines); print substr ( $foo,0,39 ); but how do I print all of these lines on one line with a space meaning e4343 d34

Re: Identifying words containing a specific substring in a sentence (was: a simple question)

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, Kevin Zhang said: >One more question, how do I strip out all letters before "xyz". For the >original example, how would I get "xyzb" and "xyzd"? I would suggest this slightly modified grep(): my @matches = grep { /(xyz.*)/ and ($_ = $1) } split ' ', $string; Here, instead o

Re: printing first 40 lines in one string

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, [EMAIL PROTECTED] said: >I have a file that looks like this: > >e4343 >d3434 >34344 >43434 >de434 > >and I am printing the first 40 lines using > >$foo = qw(my/file/with/40+lines); >print substr ( $foo,0,39 ); No, that's printing the first 39 characters of the string $foo. If you have

How to creating a package.

2004-06-16 Thread Rod Za
Hi, i like to create somethings like classes in an OOP language. The code below is correct? _BEGIN_ package PACKAGE_NAME; use strict; use warnings; our $VERSION = '0.1'; sub new{ my $self = {}; $self->{SOME_VAR} = undef; $self->{SOME_VAR2} = undef; bless $self;

How to emulate a startup command from within a Perl script?

2004-06-16 Thread Wagner, David --- Senior Programmer Analyst --- WGO
I have a Perl process which runs on solaris under 5.8.3. It is started with the following command: su - prlusr -c "/usr/bin/perl -w /d/src/plpoll.pl >> /d/audit/`date '+%y%m%d'`.out 2>&1 &" I would like to a daily basis at time switchover and after I have complete

Replace tab delimited headings in file

2004-06-16 Thread Debbie Cooper
I need to replace the tab delimited headings in a text file so that I end up with shorter (lengthwise) headings. I have headings like the following: Heading_1,122 Heading_2,122 AnotherHeading_1,1 .. I want to replace these headings with something like the following: x1 x2 and s

RE: how to sort certain pattern from a file

2004-06-16 Thread Naser Ali
Hello All, Yesterday I posted a question asking if anyone can suggest a way of accomplishing this. In the mean while I have comeup with a quick and dirty way of processing the data file and sorting it in an array. Once it is sorted, then, I can do whatever however I need to. Code is attached below

Re: a simple question

2004-06-16 Thread Bernard Kenik
This code should do it. my $List = " axyzb cxyzd "; my @Words = split(' ', $List); print "@Words\n"; my $Word; my @xyz; foreach $Word (@Words) { push @xyz, $Word if $Word =~ /.*xyz.*/; } print "@xyz"; "Kevin Zhang" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Tha

Re: printing first 40 lines in one string

2004-06-16 Thread DBSMITH
excellent ...thanks but as I was recoding I came up with another thought. How do I print a single string in front of this on line one time? the file is now e3434 e4343 de3434 3545 now I want foostring 0,0,0 e3434 e4343 de3434 3545 I tried s/(^E+ ) foostring \t0,0,0/; thank you,

Re: how to sort certain pattern from a file

2004-06-16 Thread James Edward Gray II
On Jun 16, 2004, at 12:22 PM, Naser Ali wrote: Hello All, Hello. Yesterday I posted a question asking if anyone can suggest a way of accomplishing this. In the mean while I have comeup with a quick and dirty way of processing the data file and sorting it in an array. Once it is sorted, then, I can

Re: a simple question

2004-06-16 Thread WilliamGunther
In a message dated 6/16/2004 12:10:54 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >Thanks in advance for your kind help. > >For the following string: > >" axyzb cxyzd " > >What is the command to extract the substrings with "xyz" in them? In this case, I'd like to >get two st

RE: how to sort certain pattern from a file

2004-06-16 Thread Wiggins d Anconia
> > Hello All, > > Yesterday I posted a question asking if anyone can suggest a way of > accomplishing this. In the mean while I have comeup with a quick and dirty > way of processing the data file and sorting it in an array. Once it is > sorted, then, I can do whatever however I need to. Code is

RE: how to sort certain pattern from a file

2004-06-16 Thread Naser Ali
Thanks James, I totally agree with you and appreciate your comments. I was going to refine the whole code by putting in better logic, naming convention, and error handling. I just posted the code baically to share the basic logic of handling the situation. I also did not use the correct wording as

Re: How to creating a package.

2004-06-16 Thread Randal L. Schwartz
> "Rod" == Rod Za <[EMAIL PROTECTED]> writes: Rod> Hi, i like to create somethings like classes in an OOP language. Rod> The code below is correct? Rod> _BEGIN_ Rod> package PACKAGE_NAME; Rod> use strict; Rod> use warnings; Rod> our $VERSION = '0.1'; Rod> sub new{ my $class = shift; Rod>

RE: Date and time calculation

2004-06-16 Thread Tim Johnson
Time::Local can come in very handy when you need to convert text dates to Perl time as well. -Original Message- From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] Sent: Wed 6/16/2004 7:27 AM To: Werner Otto; [EMAIL PROTECTED] Cc: Subje

Re: Replace tab delimited headings in file

2004-06-16 Thread Jeff 'japhy' Pinyan
On Jun 16, Debbie Cooper said: >I need to replace the tab delimited headings in a text file so that I end up >with shorter (lengthwise) headings. I have headings like the following: > >Heading_1,122 Heading_2,122 AnotherHeading_1,1 .. I'm assuming this will be the *first* line of a fil

string insertion

2004-06-16 Thread DBSMITH
People of the Perl, I have this file that looks like: e4933 e4343 e3435 e9809 and I am printing the first 40 lines using open FILE . ; while ( ) { chomp print "$_ " if 1 .. 40; and it gets me what I want as above on one line, but the end result needs to be eject 0,0,0 e4933 e4343 e3435

Re: string insertion

2004-06-16 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: People of the Perl, I have this file that looks like: e4933 e4343 e3435 e9809 and I am printing the first 40 lines using open FILE . ; while ( ) { chomp print "$_ " if 1 .. 40; and it gets me what I want as above on one line, but the end result needs to be eject 0

Re: Counting help

2004-06-16 Thread Rakhitha Karunarathne
what about this I think this should work faster ___ SELECT count(1), build, room FROM Jun04 WHERE dept=22 GROUP BY room, build $q = $dbh->prepare($aboveQuery); $q->exe

Re: Helpful Regular Expression Tool

2004-06-16 Thread Bruce Ferrell
Google took here: http://www.weitz.de/regex-coach/ Roberts Mr Richard L wrote: URL? thanks in advance Richard L. Roberts Systems Integrator Marine Corps Community Services 3044 Catlin Ave. Quantico, Va. 22134 Phone: 703.432.0109 Fax: 703.784.1249 Email: [EMAIL PROTECTED] -Original Message-