Re: breaking-apart and printing an input file

2009-02-20 Thread pablo
Your data is perfect for the paragraph mode* of readline: Ahh, I forgot about paragraph mode. #!/usr/bin/perl use strict; use warnings; my $user = shift; my $regex = qr/\A$user/; local $/ = ''; while (my $record = DATA) { chomp $record; if ($record =~ /$regex/) {

breaking-apart and printing an input file

2009-02-19 Thread pablo
I have a single input file with entries as follows: --snip-- USER1 [20090101] note bla bla bla bla bla bla USER2 [20090104] note bla bla bla bla bla bla --snip-- What I'm trying to do is create a single-argument script which displays all entries for a given user. So calling it as 'filter.pl

Re: breaking-apart and printing an input file

2009-02-19 Thread Rob Dixon
pa...@compugenic.com wrote: I have a single input file with entries as follows: --snip-- USER1 [20090101] note bla bla bla bla bla bla USER2 [20090104] note bla bla bla bla bla bla --snip-- What I'm trying to do is create a single-argument script which displays all entries for a

Re: breaking-apart and printing an input file

2009-02-19 Thread Chas. Owens
On Thu, Feb 19, 2009 at 22:42, pa...@compugenic.com wrote: I have a single input file with entries as follows: --snip-- USER1 [20090101] note bla bla bla bla bla bla USER2 [20090104] note bla bla bla bla bla bla --snip-- What I'm trying to do is create a single-argument script which

Re: Searching text file and printing to new file

2008-01-18 Thread Rob Dixon
Gunnar Hjalmarsson wrote: [EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable

Re: Searching text file and printing to new file

2008-01-18 Thread Gunnar Hjalmarsson
Rob Dixon wrote: Gunnar Hjalmarsson wrote: [EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: open my $IN, '', 'infile.txt' or die $!; open my $OUT, '', 'outfile.txt' or die $! while ( $IN ) { print $OUT scalar $IN if

Re: Searching text file and printing to new file

2008-01-18 Thread Tri Trinh
On Jan 18, 10:27 am, [EMAIL PROTECTED] (Rob Dixon) wrote: Gunnar Hjalmarsson wrote: [EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I have a large text file with information essentially broken into lines like this:

Re: Searching text file and printing to new file

2008-01-17 Thread PlagueMagazine
On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I'm a nearly absolute beginner to Perl, Then this site ought to be useful:http://learn.perl.org/ and a lot of the text manipulation things confuse me. Really? Which things specifically, and in what

Re: Searching text file and printing to new file

2008-01-17 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: On Jan 14, 5:08 pm, [EMAIL PROTECTED] (Gunnar Hjalmarsson) wrote: [EMAIL PROTECTED] wrote: I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable text There are plenty of

Searching text file and printing to new file

2008-01-14 Thread PlagueMagazine
I'm a nearly absolute beginner to Perl, and a lot of the text manipulation things confuse me. I have a large text file with information essentially broken into lines like this: findable text with a regexp information I care about more findable text There are plenty of sections like this in the

Re: Searching text file and printing to new file

2008-01-14 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: I'm a nearly absolute beginner to Perl, Then this site ought to be useful: http://learn.perl.org/ and a lot of the text manipulation things confuse me. Really? Which things specifically, and in what way? I have a large text file with information essentially

problem printing contents of file in directory

2007-06-28 Thread alok nath
Hi, Can anybody tell me why its not printing the contents of each inside a particular folder ? I lost all my hairs scratching my head. Thanks Alok. my $tstToRunDir = C:\\perlScripts ; my $fileInTstToRunDir ; opendir TST2RUN, $tstToRunDir || die Failed to open $tstToRunDir $!\n ; open

Re: problem printing contents of file in directory

2007-06-28 Thread John W. Krahn
alok nath wrote: Hi, Hello, Can anybody tell me why its not printing the contents of each inside a particular folder ? Yes I can, and so can Perl's documentation: perldoc -f readdir my $tstToRunDir = C:\\perlScripts ; my $fileInTstToRunDir ; opendir TST2RUN, $tstToRunDir || die Failed

Re: printing to a file if line is not there

2007-01-12 Thread FamiLink Admin
+liveshow) GET 143438 Ryan - Original Message - From: John W. Krahn [EMAIL PROTECTED] To: Perl Beginners beginners@perl.org Sent: Thursday, January 11, 2007 3:55 PM Subject: Re: printing to a file if line is not there FamiLink Admin wrote: Hello all. Hello, I am trying to read a log

Re: printing to a file if line is not there

2007-01-12 Thread John W. Krahn
FamiLink Admin wrote: John, Thanks for your help! Chomp and replacing $_ with $site did it! Below is the log if you think I can do it without so many splits that would be great! 2007.1.12 8:06:43 - 70.22.222.29 http://www.12gpatt.com/Nightlife.html *DENIED* Weighted phrase limit of

printing to a file if line is not there

2007-01-11 Thread FamiLink Admin
Hello all. I am trying to read a log file then look for a website and score. If that website has a score 100, take it and add it to a Check me list. 1. I don't want to recheck so I have a list of checked sites that I want to verify with. 2. I don't want duplicates added to the check me

Re: printing to a file if line is not there

2007-01-11 Thread John W. Krahn
FamiLink Admin wrote: Hello all. Hello, I am trying to read a log file then look for a website and score. If that website has a score 100, take it and add it to a Check me list. It would be easier to help if we could see examples of valid and invalid log file entries. 1. I don't want to

Re: Printing output to file

2004-11-13 Thread Chasecreek Systemhouse
On Sat, 13 Nov 2004 14:48:06 +0800 (CST), Stephen Liu [EMAIL PROTECTED] wrote: $ perl AAA.pl /pathto/name_of_file is it possible adding print file function to the script Maybe this example would be of benefit? http://backpan.cpan.org/authors/id/S/SN/SNEEX/accts.sx Reads a file and

Printing output to file

2004-11-12 Thread Stephen Liu
Hi folks, Instead of using following command printing output to a file; $ perl AAA.pl /pathto/name_of_file is it possible adding print file function to the script 1) If YES Please advise how to make it. 2) Can I add following bash syntax to the script user=$(whoami); now=$(date +%Y.%m.%d.%R

Re: Printing output to file

2004-11-12 Thread Renqilong
On Sat, 13 Nov 2004 11:42:13 +0800 (CST) Stephen Liu [EMAIL PROTECTED] wrote: Hi folks, Instead of using following command printing output to a file; $ perl AAA.pl /pathto/name_of_file is it possible adding print file function to the script 1) If YES Please advise how to make

Re: Printing output to file

2004-11-12 Thread Stephen Liu
Hi Renqilong, Tks for your advice. --- Renqilong [EMAIL PROTECTED] wrote: Instead of using following command printing output to a file; $ perl AAA.pl /pathto/name_of_file is it possible adding print file function to the script 1) If YES Please advise how to make

Re: Printing to a file

2004-10-29 Thread Zeus Odin
I could see this thread coming 2 months ago. Does anyone have any pent-up frustrations? :-) I think this list is the BEST list I have ever read ... not that I have read many lists. However, any list can be improved. The improvements I would suggest have to do with editorializing and patience:

Re: Printing to a file

2004-10-29 Thread John W. Krahn
Zeus Odin wrote: Charles Clarkson, Randall Schwartz, and John Krahn (I'm only naming three. You probably meant Randal Schwartz (one l.) :-) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Printing to a file

2004-10-29 Thread Zeus Odin
my $hero = 'John Krahn'; $hero =~ s/John Krahn/Jenda Krynicky/; :-) I can't believe I wrote what I thought was a thoughtful post that would hopefully make perl.beginners a better place to frequent (good luck!) and all I get is: Dude, Randal is spelled with one L not two. Pay attention. I'm John

Printing to a file

2004-10-26 Thread Kevin Old
Hello everyone, First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. For some reason nothing is being printed to the MY filehandle. Can someone see what I'm doing wrong? #!/usr/bin/perl

Re: Printing to a file

2004-10-26 Thread JupiterHost.Net
Kevin Old wrote: Hello everyone, First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. For some reason nothing is being printed to the MY filehandle. Can someone see what I'm doing wrong? Is if ( $_ =~

Re: Printing to a file

2004-10-26 Thread Brian Gunlogson
Put the MY in braces. SO print MY $line; WOULD BECOME print {MY} $line; --- Kevin Old [EMAIL PROTECTED] wrote: Hello everyone, First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. For some reason nothing is being printed

Re: Printing to a file

2004-10-26 Thread Gunnar Hjalmarsson
Kevin Old wrote: First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. Just an hour, and you think it's already justified to waste hundreds of other person's time? I disagree. You need to be a lot more patient if you want to learn

Re: Printing to a file

2004-10-26 Thread Kevin Old
On Tue, 26 Oct 2004 10:57:39 -0500, JupiterHost.Net [EMAIL PROTECTED] wrote: Kevin Old wrote: Hello everyone, First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. For some reason nothing is being printed to the MY

RE: Printing to a file

2004-10-26 Thread Bob Showalter
Brian Gunlogson wrote: Put the MY in braces. SO print MY $line; WOULD BECOME print {MY} $line; Why? That fails under use strict, and is totally unecessary. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Printing to a file

2004-10-26 Thread Kevin Old
On Tue, 26 Oct 2004 19:17:11 +0200, Gunnar Hjalmarsson [EMAIL PROTECTED] wrote: Kevin Old wrote: First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. Just an hour, and you think it's already justified to waste hundreds of

Re: Printing to a file

2004-10-26 Thread Chap Harrison
Wait a minute there. I'm not learning programming. I've been a perl programmer for 7 years and have written hundreds of more complex programs than this and have written to thousands of files in my time. I just needed another pair of eyes to possibly point out what I was doing wrong. Also,

Re: Printing to a file

2004-10-26 Thread Steve Bertrand
On Tue, 26 Oct 2004 10:57:39 -0500, JupiterHost.Net [EMAIL PROTECTED] wrote: Kevin Old wrote: Hello everyone, First, this is a basic problem, but I have looked at it for over an hour and wasted time. Now, I'm asking for help. For some reason nothing is being printed to the MY

Re: Printing to a file

2004-10-26 Thread Gunnar Hjalmarsson
Chap Harrison wrote: Ah-freakin'-men. Gunnar, what the *hell*? I've been reading this list for a couple of months now and the majority of your posts seem to be little more than chiding people in an extremely unpleasant tone. If you find a *particular* post extremely unpleasantly worded, please

RE: Printing to a file

2004-10-26 Thread Brian Gunlogson
Oops, my bad. This looked like a problem I had. I stored a filehandle in a hash, and it confused print when I accessed the filehandle as a scalar. I'd better think before I post again... *blush* --- Bob Showalter [EMAIL PROTECTED] wrote: Brian Gunlogson wrote: Put the MY in braces. SO

Re: Printing to a file

2004-10-26 Thread DBSMITH
I agree, Gunnar is mean. Mean people suck! derek Chap Harrison [EMAIL PROTECTED] 10/26/2004 01:37 PM To: Gunnar Hjalmarsson [EMAIL PROTECTED] cc: Perl Lists [EMAIL PROTECTED] Subject:Re: Printing to a file Wait a minute there. I'm not learning

Re: Printing to a file

2004-10-26 Thread JupiterHost.Net
[EMAIL PROTECTED] wrote: I agree, Gunnar is mean. Mean people suck! Ok, everyone calm down :) Perhaps some folks can be a bit blunt and maybe its even wrong *but* the content was good if not the delivery :) As a support person myself it is extremely annoying when soemone comes up and says My

Re: Printing to a file

2004-10-26 Thread Felix Li
print Gunnar does not suffer fools gladly.\nSo?; print Try not to look like a fool!; - Original Message - From: JupiterHost.Net [EMAIL PROTECTED] To: Perl Lists [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 4:01 PM Subject: Re: Printing to a file [EMAIL PROTECTED] wrote: I

RE: Printing to a file

2004-10-26 Thread Ed Christian
#!/usr/bin/perl + use warnings; use strict; use File::Find; find sub { return unless -f; return unless $_ =~ /.\d+$/; print $_\n; #print $File::Find::name\n; + open(SD, $_) or die can't open $_ $!\n; #my $fh = IO::File-new( /tmp/savedata/new/$_)

Re: Printing to a file

2004-10-26 Thread DBSMITH
PROTECTED] cc: Subject:Re: Printing to a file [EMAIL PROTECTED] wrote: I agree, Gunnar is mean. Mean people suck! Ok, everyone calm down :) Perhaps some folks can be a bit blunt and maybe its even wrong *but* the content was good if not the delivery :) As a support

RE: Printing to a file

2004-10-26 Thread Ed Christian
Ed Christian wrote: #!/usr/bin/perl + use warnings; use strict; use File::Find; find sub { return unless -f; return unless $_ =~ /.\d+$/; print $_\n; #print $File::Find::name\n; + open(SD, $_) or die can't open $_ $!\n; #my $fh = IO::File-new(

Printing a text file

2001-12-11 Thread Ben Crane
Hi list, Does anyone know how to print out a text file to a printer? i would like the option of chosing a printer to send the document to, in addition, will I need to reformat the text, or will it print out the text file as is? Thanx Ben __ Do

Re: Printing a text file

2001-12-11 Thread Andrea Holstein
Ben Crane wrote: Hi list, Does anyone know how to print out a text file to a printer? i would like the option of chosing a printer to send the document to, in addition, will I need to reformat the text, or will it print out the text file as is? Have searched in search.cpan.org for

Searching and printing a text file

2001-06-19 Thread SAWMaster
Hi group! Ok, I'm trying to open all files in the directory containing my script, and search each one for lines containing my search string. This is my code so far: $i = 0; opendir(logdir, '.') or die Can't open directory.; print Enter string to search for: ; $searchstring = ; print \n; #print

Re: Searching and printing a text file

2001-06-19 Thread Me
while(logfile) { #if(#line I'm currently on is m/$searchstring/i) { print; } Now the problem is, how do I specify The line I'm currently working on? That's easy -- you don't. When you said: print; you didn't specify what to

Re: Searching and printing a text file

2001-06-19 Thread SAWMaster
Ok, I think I understand you, but things still are not working right. Never mind, I forgot to chop my search string. Works great now :) TDH (That DID help) lol.