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/) {
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
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
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
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
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
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:
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
[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
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
[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
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
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
+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
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
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
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
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
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
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
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
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:
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/
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
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
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 ( $_ =~
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
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
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
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/
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
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,
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
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
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
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
[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
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
#!/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/$_)
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
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(
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
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
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
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
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.
46 matches
Mail list logo