Re: Delete a particular line from file

2007-05-14 Thread Jeff Pang
sivasakthi 写道: > Hi, > > I have used the file in perl, file contains like that, > > 1176369096.111468 172.16.2.80 TCP_MISS/200 9629 > 1176378643.614458 172.16.2.80 TCP_MISS/200 9626 > 1176378681.984662 172.16.2.75 TCP_MISS/200 9626 > 1176436396.304 1142 172.16.2.80 TCP_MISS/200 1

Delete a particular line from file

2007-05-14 Thread sivasakthi
Hi, I have used the file in perl, file contains like that, 1176369096.111468 172.16.2.80 TCP_MISS/200 9629 1176378643.614458 172.16.2.80 TCP_MISS/200 9626 1176378681.984662 172.16.2.75 TCP_MISS/200 9626 1176436396.304 1142 172.16.2.80 TCP_MISS/200 13281 1176436397.228916 172

Re: regex question

2007-05-14 Thread Chas Owens
On 5/14/07, Jeff Pang <[EMAIL PROTECTED]> wrote: snip Maybe a space following the "by" is needed? :) snip This what the word boundary character class is for perl -le' for ( "abc from to the word by and the end", "abc from to the end", "abc from this byebye to this") { print $1 if /from(.*?(?

Re: Attempting to update files blanks them instead

2007-05-14 Thread Chas Owens
On 5/14/07, Kent Frazier <[EMAIL PROTECTED]> wrote: That did the trick. I figured it had to be something simple. To my credit, the book had it wrong too. Anyways, thanks for your help. snip Unfortunately errors creep into all printed works. The following four links are the errata pages for

Re: regex question

2007-05-14 Thread Igor Sutton Lopes
Hi, On May 14, 2007, at 11:50 PM, Tom Allison wrote: yitzle wrote: # Requires "by": $line = "daffromHello Worldby"; $line =~ /from(.*)(by)/; print $1; Not sure about making it optional. Can always check if you got "" and then try without the "by" the .* pulls in too much. I'm going to have

Re: regex question

2007-05-14 Thread Jeff Pang
John W. Krahn 写道: $ perl -le' for ( "abc from to the word by and the end", "abc from to the end" ) { print $1 if /from(.*?(?=by)|.*)/; } ' But this coundn't handle this case: $string = "abc from to the word byebye..."; Maybe a space following the "by" is needed? :) -- To unsubscrib

Re: regex question

2007-05-14 Thread John W. Krahn
Tom Allison wrote: > How do I pull all the words from a line between the two words 'from' and > 'by' when I have NO IDEA what's in there, but I know they are all in one > line. > > To make it more difficult. 'by' is optional... > > Like this: > > from..by.. > or > from.. > > I want

Re: regex question

2007-05-14 Thread Tom Allison
yitzle wrote: # Requires "by": $line = "daffromHello Worldby"; $line =~ /from(.*)(by)/; print $1; Not sure about making it optional. Can always check if you got "" and then try without the "by" the .* pulls in too much. I'm going to have to back up and try this again. But I think it's late.

Re: regex question

2007-05-14 Thread yitzle
# Requires "by": $line = "daffromHello Worldby"; $line =~ /from(.*)(by)/; print $1; Not sure about making it optional. Can always check if you got "" and then try without the "by" On 5/14/07, Tom Allison <[EMAIL PROTECTED]> wrote: How do I pull all the words from a line between the two words 'f

RE: LibXML help

2007-05-14 Thread Tony Heal
That is the file that I confirmed is readable. In fact I swapped lines 16 and 18 and the error moved to line 18. I have also written a small script that opens both files and reads the first 3 lines. That script completed successfully. After swapping lines 16 & 18 I see that the error has moved,

regex question

2007-05-14 Thread Tom Allison
How do I pull all the words from a line between the two words 'from' and 'by' when I have NO IDEA what's in there, but I know they are all in one line. To make it more difficult. 'by' is optional... Like this: from..by.. or from.. I want all the stuff inside. Initially I'm think

Re: LibXML help

2007-05-14 Thread Tom Phoenix
On 5/14/07, Tony Heal <[EMAIL PROTECTED]> wrote: When I run this, I get 'No such file or directory at /usr/lib/perl5/XML/ LibXML.pm line 518. at ./temp.pl line 16'. I have confirmed that the file exists and is readable. The file named there is not the one that doesn't exist; that's the source

Re: LibXML help

2007-05-14 Thread Chas Owens
On 5/14/07, Tony Heal <[EMAIL PROTECTED]> wrote: When I run this, I get 'No such file or directory at /usr/lib/perl5/XML/LibXML.pm line 518. at ./temp.pl line 16'. I have confirmed that the file exists and is readable. snip If both the xml and xsl files exist and are readable to the user who

RE: LibXML help

2007-05-14 Thread Tony Heal
Oops. BTW line 16 is my $source = $parser->parse_file( '/usr/local/twikixconf/tmpxconf/epace/src/conf/epace.xconf' ); Tony > -Original Message- > From: Tony Heal [mailto:[EMAIL PROTECTED] > Sent: Monday, May 14, 2007 8:40 PM > To: beginners@perl.org > Subject: LibXML help > > When

Re: File Handling. Reading and Writting.

2007-05-14 Thread Tom Phoenix
On 5/14/07, Bruno Schroeder <[EMAIL PROTECTED]> wrote: I am trying to read and write in a file, I am using something like: open (FILE, "+ A little better is to include $! in the message, maybe like this: open FILE, "+ for my $line () { print $line; if($line eq "X\n") { print F

LibXML help

2007-05-14 Thread Tony Heal
When I run this, I get 'No such file or directory at /usr/lib/perl5/XML/LibXML.pm line 518. at ./temp.pl line 16'. I have confirmed that the file exists and is readable. How do I T/S this? Tony #!/usr/bin/perl use warnings; use strict; use XML::LibXSLT; use XML::LibXML; su

File Handling. Reading and Writting.

2007-05-14 Thread Bruno Schroeder
Hello All. I am trying to read and write in a file, I am using something like: open (FILE, "+) { print $line; if($line eq "X\n") { print FILE "b\n" } else { print FILE "c\n" } } print FILE "Y\n"; close FILE; In the attached file, I whant to write inside the $modify_clas

Re: Thoughts on comments

2007-05-14 Thread Chas Owens
On 5/14/07, David Moreno Garza <[EMAIL PROTECTED]> wrote: Dr.Ruud wrote: > The / is taken, but there are many other ways to do multiline comments. > For one, see perldoc perlpod. You mean using =begin, =end? They are not exactly multiline *comments*. -- David Moreno Garza <[EMAIL PROTECTED]> |

Re: Thoughts on comments

2007-05-14 Thread David Moreno Garza
Dr.Ruud wrote: > The / is taken, but there are many other ways to do multiline comments. > For one, see perldoc perlpod. You mean using =begin, =end? They are not exactly multiline *comments*. -- David Moreno Garza <[EMAIL PROTECTED]> | http://www.damog.net/ http://www.georgedillon.com/web/html

Re: decode function equal to Java's

2007-05-14 Thread Chas Owens
On 5/14/07, Jen mlists <[EMAIL PROTECTED]> wrote: 2007/5/14, Chas Owens <[EMAIL PROTECTED]>: > #!/usr/bin/perl > use strict; > use warnings; > > use strict; > use Encode; > use URI::Escape; > my $str = 'Perl%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%28%EF%BF%BD%EF%

Re: decode function equal to Java's

2007-05-14 Thread Jen mlists
2007/5/14, Chas Owens <[EMAIL PROTECTED]>: #!/usr/bin/perl use strict; use warnings; use strict; use Encode; use URI::Escape; my $str = 'Perl%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%28%EF%BF%BD%EF%BF%BD%EF%BF%BD%C4%B0%EF%BF%BD%29.pdf'; my $tr = encode("utf8",de

Re: cpan question

2007-05-14 Thread Robert Hicks
Xavier Noria wrote: On May 14, 2007, at 3:50 PM, Robert Hicks wrote: I am working on a Perl 5.6.0 project and went to use "cpan" at the command line and behold it was not there. I download the 5.6.1 tar file and behold "cpan" the command line program wasn't in there either. Did it not come w

Re: cpan question

2007-05-14 Thread Chas Owens
On 5/14/07, Xavier Noria <[EMAIL PROTECTED]> wrote: snip perl -MCPAN -e 'install Module' snip or perl -MCPAN -e shell If you prefer and interactive version of CPAN. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: call system command

2007-05-14 Thread Chas Owens
On 5/14/07, Tatiana Lloret Iglesias <[EMAIL PROTECTED]> wrote: snip my $status = system("d:\\blast\\bin\\blastall -p blastn -i $file -d $patDB -o $workdir\\blast_$blast_file_id.txt"); snip Just an unrelated note to make your life a little easier, Perl automagically uses the right directory sepa

Re: Attempting to update files blanks them instead

2007-05-14 Thread Chas Owens
On 5/14/07, Kent Frazier <[EMAIL PROTECTED]> wrote: snip Can someone with a more honed eye for this code tell me what I am doing wrong? snip You are never printing anything. Try #!perl -w use strict; $^I = ".bak"; while (<>) { if ( /^#!/ ) { $_ .= "## Copyright (C) 2007 by Kent Fra

Re: cpan question

2007-05-14 Thread Xavier Noria
On May 14, 2007, at 3:50 PM, Robert Hicks wrote: I am working on a Perl 5.6.0 project and went to use "cpan" at the command line and behold it was not there. I download the 5.6.1 tar file and behold "cpan" the command line program wasn't in there either. Did it not come with 5.6.0/5.6.1?

Re: call system command

2007-05-14 Thread Xavier Noria
On May 14, 2007, at 3:52 PM, Tatiana Lloret Iglesias wrote: Thank a lot! Another related question,,, system command can be used also for linux? Sure. Of course it is unlikely that the arguments themselvels are portable in practice, I mean blastall won't probably be located at "d: \\blast\\

cpan question

2007-05-14 Thread Robert Hicks
I am working on a Perl 5.6.0 project and went to use "cpan" at the command line and behold it was not there. I download the 5.6.1 tar file and behold "cpan" the command line program wasn't in there either. Did it not come with 5.6.0/5.6.1? I don't see where I can get it either... Robert -- T

Re: call system command

2007-05-14 Thread Tatiana Lloret Iglesias
Thank a lot! Another related question,,, system command can be used also for linux? Regards T On 5/14/07, Xavier Noria <[EMAIL PROTECTED]> wrote: On May 14, 2007, at 3:44 PM, Tatiana Lloret Iglesias wrote: > Hi all, > > I have to execute this command from perl: > > my $status = system("d:\\bl

Re: call system command

2007-05-14 Thread Xavier Noria
On May 14, 2007, at 3:44 PM, Tatiana Lloret Iglesias wrote: Hi all, I have to execute this command from perl: my $status = system("d:\\blast\\bin\\blastall -p blastn -i $file -d $patDB -o $workdir\\blast_$blast_file_id.txt"); but the problem is that $workdir contains spaces how can I

call system command

2007-05-14 Thread Tatiana Lloret Iglesias
Hi all, I have to execute this command from perl: my $status = system("d:\\blast\\bin\\blastall -p blastn -i $file -d $patDB -o $workdir\\blast_$blast_file_id.txt"); but the problem is that $workdir contains spaces how can I make it work? Thanks! Regards T

Attempting to update files blanks them instead

2007-05-14 Thread Kent Frazier
First off, this is my first post to this list, so hello everyone. I am pretty new to Perl, and to programming in general, but I hope I can be of help to some of you in the future. Right now, though, I am pretty confused because one of my programs is not working the way I expect it to, and I can'

Re: decode function equal to Java's

2007-05-14 Thread Chas Owens
On 5/14/07, Jen mlists <[EMAIL PROTECTED]> wrote: snip I need to translate this string, Perl%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%28%EF%BF%BD%EF%BF%BD%EF%BF%BD%C4%B0%EF%BF%BD%29.pdf This was a string appeared in our web logs. snip The following worked for me.

Re: Variables not replaced

2007-05-14 Thread Chas Owens
On 5/14/07, tannhauser <[EMAIL PROTECTED]> wrote: snip My problem: I also want to replace quotions, depending whether they are at the beginning or the end of a word. For example "tick" should become ``tick''. Annoyingly, my script just gives me ``$1ic$1''. Any ideas? snip The problem here is t

Re: Break up names

2007-05-14 Thread Jay Savage
On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 5/11/07, Tony Heal <[EMAIL PROTECTED]> wrote: > I have a list of names that I need to break up and reassemble. > > The list consists of the first name and last name combined as a single word in wiki format. i.e.JoeBlow > > I need to break this

Re: Can't sort error out; strict refs

2007-05-14 Thread Rob Dixon
Mathew Snyder wrote: I'm passing two hash references into a subroutine. One hash is in the format of $dept{$env}{$user}. This contains an amount of time spent by each user on a customer ($env). The second hash is in the format of $ticCount{$env}{$user}{$ticID}. This contains a running count

Re: Variables not replaced

2007-05-14 Thread tannhauser
Please don't care that the replacement right now is deleting the whitespace (yes, that's not wanted). i copied the wrong version. but that doesn't affect the problem i described. thanks tannhauser. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Variables not replaced

2007-05-14 Thread tannhauser
Hello, to prepare a (non-technical or -mathematical) txt-file for use with tex, i have to replace a few things: umlauts, underscores, special characters and so on. My problem: I also want to replace quotions, depending whether they are at the beginning or the end of a word. For example "tick" sho

Can't sort error out; strict refs

2007-05-14 Thread Mathew Snyder
I'm passing two hash references into a subroutine. One hash is in the format of $dept{$env}{$user}. This contains an amount of time spent by each user on a customer ($env). The second hash is in the format of $ticCount{$env}{$user}{$ticID}. This contains a running count of how many times a user

Re: decode function equal to Java's

2007-05-14 Thread Jen mlists
2007/5/11, Dr.Ruud <[EMAIL PROTECTED]>: "Jen mlists" schreef: > I'm faint I MUST take the time to work with double-character > handling though I'm not familiar with it. > What's the function in perl which is equal to Java's this call: > java.net.URLDecoder.decode(s, "UTF-8") Hello all, I nee

Re: Thoughts on comments

2007-05-14 Thread Dr.Ruud
Jeff Pang schreef: > One thing I'm not satisfied with in perl is that why it > does'nt support the multi-lines comments like /*...*/ in C. The / is taken, but there are many other ways to do multiline comments. For one, see perldoc perlpod. -- Affijn, Ruud "Gewoon is een tijger." -- To unsu