maybe this script may help:
use strict;
use warnings;
my %data;
while ( defined ( my $line = readline ) ) {
chomp $line;
my ($date, $num) = split(/,/, $line);
push(@{$data{$date}}, $num);
}
foreach my $date (sort keys %data) {
print join(',', $date, @{$data{$date}}), "\n";
}
pe
file 1
2010-11-21,2
2010-12-01,1
file 2
2010-11-22,12
2010-12-01,11
this is for GD graph and the file file should be like this
2010-11-21,2
2010-11-22,12
2010-12-01,1,11
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://le
Hello.
I have a few tasks I would like to play and learn with, and would
appreciate a bit of help please.
Starting in c:\testing\testing123\ I have 2 more levels of folders.
eg.
c:\testing\testing123\a\b\
I would like to recurse all files and folders under testing123.
Check filenames for ", "
John W. Krahn wrote:
> Rob Dixon wrote:
>>
>> There is no write function.
>
> I beg to differ:
>
> perldoc -f write
> write FILEHANDLE
> write EXPR
> write Writes a formatted record (possibly multi-line) to the
> specified FILEHANDLE, using the format associated with
Hi Anjan,
ANJAN PURKAYASTHA wrote:
shawn,
thanks for the pointers.
looks like you have saved me from buying more disks ;)!
anjan
A bit too late, but another option is to compress the input file using
gzip and then read it in a line at a time and decompress in-memory.
Then, write it out
Rob Dixon wrote:
ANJAN PURKAYASTHA wrote:
while (){
while (<$in>) {
chomp;
process line here
write OUT ("$abcd\n");
There is no write function.
I beg to differ:
perldoc -f write
write FILEHANDLE
write EXPR
write Writes a formatted record (possibly multi-line) to th
shawn,
thanks for the pointers.
looks like you have saved me from buying more disks ;)!
anjan
On Thu, Aug 21, 2008 at 3:40 PM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote:
> On Thu, 2008-08-21 at 15:23 -0400, ANJAN PURKAYASTHA wrote:
> > ok here is the problem. i have a limited amount of memory.
ANJAN PURKAYASTHA wrote:
>
> ok here is the problem. i have a limited amount of memory.
>
> i need to open a large file (~600 megs). i have to open a filehandle, read
> and process each line and write the output result into another file (which
> soon grows to about 300 megs.
> so,
Always
use s
On Thu, 2008-08-21 at 15:23 -0400, ANJAN PURKAYASTHA wrote:
> ok here is the problem. i have a limited amount of memory.
>
> i need to open a large file (~600 megs). i have to open a filehandle, read
> and process each line and write the output result into another file (which
> soon grows to about
ok here is the problem. i have a limited amount of memory.
i need to open a large file (~600 megs). i have to open a filehandle, read
and process each line and write the output result into another file (which
soon grows to about 300 megs.
so,
open (IN, "averylargefile");
open (OUT, "anotherveryla
On Thu, May 1, 2008 at 11:20 PM, Anderson Ramroop <[EMAIL PROTECTED]> wrote:
>
> I just want to pull the latest data with the Acct number...
>
> not the whole string sorted by date?
>
Please submit the question back to the list.
For this case, codes could be:
use strict;
use Time::Local;
my @ar
On Thu, May 1, 2008 at 5:04 AM, Andy <[EMAIL PROTECTED]> wrote:
>
> Basically I need to be able to pull the latest data.
>
> for instance
>
> 155073040~06/04/1998
> 155073040~04/28/1998
> 155073040~04/29/1998
>
> Has 3 Id Numbers for the same data.
>
> If Id's are the same Pull Latest Data?
Andy wrote:
Hiya Guys
Well I am new, and still trying to learn perl...
Do not multi-post!!
http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/bb85e891b4b9435a
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
F
Hiya Guys
Well I am new, and still trying to learn perl...while at work on 10
different thingssheesh is there ever enough time to learn
something..
Needless to say
I need to accomplish the following.
Data Below
155073040~06/04/1998
155073040~04/28/1998
155073040~04/29/1998
255256040~04/29/
[please keep on list]
[especially when the person you're e-mailing is out of town ;) ]
- Show quoted text -
On Wed, 24 Nov 2004 09:17:18 -0500, FlashMX <[EMAIL PROTECTED]> wrote:
>
> Hi Jay,
>
> I'm getting mixed reviews on how to do this script. I've been told by dumping
> the input file to an
On Tue, 23 Nov 2004 09:44:00 -0500 (EST), Chris Devers wrote:
>On Tue, 23 Nov 2004, FlashMX wrote:
>
>> I'm trying to do this script on my own as suggested by someone in this
>> group.
>
>Glad to hear it :-)
>
>> I'm getting confused on the login.
>
>I don't see where the program or the problem de
On Tue, 23 Nov 2004, FlashMX wrote:
> I'm trying to do this script on my own as suggested by someone in this
> group.
Glad to hear it :-)
> I'm getting confused on the login.
I don't see where the program or the problem description involves
logging in to anything -- is that really what you me
I'm trying to do this script on my own as suggested by someone in this group. I
have the book "Teach yourself Perl in 21 days" So far I've been able to open
the file and execute a grep to search
for certain text and then display the hits.
I'm getting confused on the login. I need to open the o
I'm a perl noob, so I'm not sure if this is the best way to do it, but
just a thought:
When a program is accessing the file create a file like:
filename.lock. Delete it when you're done. Then check to see if
filename.lock exists before trying to access the program -- if not
sleep.
Of course, I
Hi,
I am writing a Perl program that reads files created by another independent process.
I have to take care that the perl program does not read the files that are in the
process of
getting created.
I am programming in Windows NT environment.
It is also not possible for the perl program to get
Silja Rajendran wrote:
I am a unix admin tasked with writing script for
synchronizing the password between two servers. I
though it can be done better using perl and hence this
question.
http://search.cpan.org/search?query=passwd&mode=module
http://search.cpan.org/search?query=shadow&mode=module
P
Hi,
I am a unix admin tasked with writing script for
synchronizing the password between two servers. I
though it can be done better using perl and hence this
question.
the following is the description :
1. shadow1 - /etc/shadow file from first server
2. shadow2 - /etc/shadow file from second serv
From: Bernhard van Staveren <[EMAIL PROTECTED]>
> [snippity]
>
> > 1. As you can see, my program is going to be running infinitly.
> > Will this be a problem? I will probably make this program as a
> > service on win 2000 so it runs right awway when the computer is
> > turned on.
>
> It'll was
2:13 PM
To: Poon, Kelvin (Infomart)
Cc: [EMAIL PROTECTED]
Subject: Re: File Manipulation Program
[snippity]
> 1. As you can see, my program is going to be running infinitly. Will this
> be a problem? I will probably make this program as a service on win 2000
so
> it runs right awway whe
[snippity]
> 1. As you can see, my program is going to be running infinitly. Will this
> be a problem? I will probably make this program as a service on win 2000 so
> it runs right awway when the computer is turned on.
It'll waste an awful lot of CPU cycles like that; I'm not sure if Win2000 h
Hi,
I have a project at work that I need help on. I have couple of questions
regarding to my "file manipulation program" and was wondering if anyone
could help me. Thanks a lot. I really appreicate it.
About the program:
- There is an input folder and an output folder
- *.pdf f
I'm writing a shell script, which will take a list of files on the
command line, so u run the script like
e.g
The list of files is not fixed, so I need to execute this for any number
of files given by the user
Step 1 Using either sed or gawk/awk , I need to separate these files by
white s
> "Drieux" == Drieux <[EMAIL PROTECTED]> writes:
Drieux> I just do NOT know right off the top of my head, when,
Drieux> where or HOW I would use that type of a conditional in a split...
@lines = split /\^M\^J|\^J|\^M/, $text_with_unknown_line_endings;
--
Randal L. Schwartz - Stonehenge Co
On Friday, May 10, 2002, at 03:29 , Jeff 'japhy' Pinyan wrote:
[..]
> I'm not necessarily speaking to you -- I'm reminding anyone reading these
> messages that at no point do single quotes stop a regex from being a
> regex.
>
> [snip credentials]
>
>> I know what INTERPOLATION is, and the differ
On May 10, Jonathan E. Paton said:
>> >and hence the magic of using single quotes doesn't work as you'd expect.
>> >It does get you out of other trouble though:
>> >
>> >s'$%@|'replacement';
>> >
>> >where you'd otherwise spend all day backslashing things.
>>
>> All single quotes do is stop INTE
> >and hence the magic of using single quotes doesn't work as you'd expect.
> >It does get you out of other trouble though:
> >
> >s'$%@|'replacement';
> >
> >where you'd otherwise spend all day backslashing things.
>
> All single quotes do is stop INTERPOLATION. Interpolation is not the
> issue
On Fri, 2002-05-10 at 16:54, drieux wrote:
>
> On Friday, May 10, 2002, at 01:20 , Jeff 'japhy' Pinyan wrote:
>
> > On May 10, Jonathan E. Paton said:
> >
> >> Opps! NB: Also lost the lc() from this too :P
> >
> > Gah! ;)
>
> isn't there a requirement that you are
> not allowed to swear in Kli
On Friday, May 10, 2002, at 01:20 , Jeff 'japhy' Pinyan wrote:
> On May 10, Jonathan E. Paton said:
>
>> Opps! NB: Also lost the lc() from this too :P
>
> Gah! ;)
isn't there a requirement that you are
not allowed to swear in Klingon on a public
email list
myJackBootedFascistHouseMate alw
On May 10, Jonathan E. Paton said:
>and hence the magic of using single quotes doesn't work as you'd expect.
>It does get you out of other trouble though:
>
>s'$%@|'replacement';
>
>where you'd otherwise spend all day backslashing things.
All single quotes do is stop INTERPOLATION. Interpolatio
> > Oh yeah makes perfect sense now...match nothing or nothing and sense
> > everything has nothing it always matches. haha...I like that.
> >
> > Tanton
>
> I guess the two HORRORS I would like to stomp on are
>
> a) using "|" as a delimiter
Everyone should be using the standard CSV nota
On May 10, Jonathan E. Paton said:
>Opps! NB: Also lost the lc() from this too :P
Gah! ;)
>perl -ne '!$seen{lc~~(split/\|/)[3]}++&&print' input > output
s/~~/+/;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.
On Friday, May 10, 2002, at 12:41 , Tanton Gibbs wrote:
> Oh yeah makes perfect sense now...match nothing or nothing and sense
> everything has nothing it always matches. haha...I like that.
>
> Tanton
I guess the two HORRORS I would like to stomp on are
a) using "|" as a delimiter
> > Looks like that question has been quite well covered.
> > Under Unix, my simple version can be reduced to:
> >
> >cat list.current | perl -ne 'print if not $seen{split'|'}++' > list.new
>
> Not so.
Had you fooled for a moment!
> First, you've got quote problems.
Doh! I'd prefer to change
On May 10, Jonathan E. Paton said:
>> I meant to convert the email address to lowercase...
>
>Wonder where you got that idea? ;-)
Oh, hush. ;) We all had the same answers, more or less.
>Looks like that question has been quite well covered. Under Unix, my simple
>version can be reduced to:
>
> >>I am using it as a mailing list. However, over the last half year, it has
> >>gotten pretty big, and has some duplicates in it. For reporting sake, I
> >>would like to delete the duplicate records based on email addresses. If you
> >>sign up three times, I only want to keep your first recor
Oh yeah makes perfect sense now...match nothing or nothing and sense
everything has nothing it always matches. haha...I like that.
Tanton
- Original Message -
From: "Jonathan E. Paton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 10, 2002 3:41 PM
> I ran some tests and it looks like /|/ matches just about anything...what
> does /|/ mean?
If it were a regex, hang on... maybe it is... it would mean:
Match a zero length string OR a zero length string. | is the regex character
for OR.
Jonathan Paton
___
lt;[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, May 10, 2002 3:36 PM
Subject: Re: Text file manipulation
> On May 10, Tanton Gibbs said:
>
> >while( ) { # loop through the file, store current rec in $_
> > my @record = split(/|/,$_); # record[0] = lastnam
On May 10, Jeff 'japhy' Pinyan said:
>On May 10, Hughes, Andrew said:
>
>>I am using it as a mailing list. However, over the last half year, it has
>>gotten pretty big, and has some duplicates in it. For reporting sake, I
>>would like to delete the duplicate records based on email addresses. I
On May 10, Tanton Gibbs said:
>while( ) { # loop through the file, store current rec in $_
> my @record = split(/|/,$_); # record[0] = lastname
You need to split on /\|/, not /|/.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http:/
On May 10, Hughes, Andrew said:
>I am using it as a mailing list. However, over the last half year, it has
>gotten pretty big, and has some duplicates in it. For reporting sake, I
>would like to delete the duplicate records based on email addresses. If you
>sign up three times, I only want to
]
Subject:Re: Text file manipulation
Probably something like this:
open FILE, "input.txt" or die "Could not open input.txt:
$!\n"; # open the
input file containing the records
open OUTFILE, ">o
> I want this file:
>
> jones|Bob|Acme1|[EMAIL PROTECTED]|GA|2/25/2002
> jones|Bob|Acme1|[EMAIL PROTECTED]|GA|2/28/2002
> smith|Jan|Acme2|[EMAIL PROTECTED]|FL|3/1/2002
> johnson|Salley|Acmeshop|[EMAIL PROTECTED]|TN|4/5/2002
>
> SMITH|JAN|ACME2|[EMAIL PROTECTED]|FL|5/2/2002
>
> to change to this
# record[2] = company
# record[3] = email
print OUTFILE $_ if !$addys{$record[3]}++;
# if we have not seen the email before, then write it to the output file.
}
- Original Message -
From: "Hughes, Andrew" <[EMAIL PROTECTED]>
To: <[EMAIL PRO
I have a pipe delimited text file that I use as a mailing list I have
information in the following format:
lastname|firstname|company|email|state|date
I am using it as a mailing list. However, over the last half year, it has
gotten pretty big, and has some duplicates in it. For reporting sake
From: "Ho, Tony" <[EMAIL PROTECTED]>
> I am currently designing Perl DBI code to extract data from tables
> from Sybase Database under UNIX. There are a dozen of tables I need to
> extract information from. The biggest tables are ACCOUNTS and
> SUBSCRIBERS. ACCOUNT has 10 million
Greeting Tony,
"Tony Ho" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi guys
> I was wondering if you could help me.
>
> I am currently designing Perl DBI code to extract data from tables from
> Sybase Database under UNIX.
> There are a dozen of tables I ne
Hi guys
I was wondering if you could help me.
I am currently designing Perl DBI code to extract data from tables from
Sybase Database under UNIX.
There are a dozen of tables I need to extract information from.
The biggest tables are ACCOUNTS and SUBSCRIBERS.
ACCOUNT has 10 million rows and
David Gilden [[EMAIL PROTECTED]] quoth:
*>
*>mycomputer% perl -ews foreach $files (<./*>) {rename($file,"new-$file");}
*>
*>Am I on the right track?
To pain, yes :) Check out File::Find and you might also learn the joys of
your shell with sed and awk :)
http://www.perlfaq.com/cgi-bin/view?view_
Hi,
How would you approach the following:
in a directory (on a UNIX box)
file-a
file-b
file-c
file-d
This what I like have after I run a script or a mysterious UNIX command:
1-file-a
2-file-b
3-file-c
4-file-d
*** OR ***
new-file-a
new-file-b
new-file-c
new-file-d
Possible script untest
55 matches
Mail list logo