Re: file manipulation

2011-02-14 Thread marcos rebelo
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 manipulation

2011-02-14 Thread Muzammil
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

File manipulation

2008-11-27 Thread Brian
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 ", "

Re: file manipulation

2008-08-22 Thread Rob Dixon
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

Re: file manipulation

2008-08-21 Thread Raymond Wan
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

Re: file manipulation

2008-08-21 Thread John W. Krahn
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

Re: file manipulation

2008-08-21 Thread ANJAN PURKAYASTHA
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.

Re: file manipulation

2008-08-21 Thread Rob Dixon
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

Re: file manipulation

2008-08-21 Thread Mr. Shawn H. Corey
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

file manipulation

2008-08-21 Thread ANJAN PURKAYASTHA
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

Re: File Manipulation ??

2008-05-01 Thread J. Peng
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

Re: File Manipulation ??

2008-04-30 Thread J. Peng
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?

Re: File Manipulation ??

2008-04-30 Thread Gunnar Hjalmarsson
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

File Manipulation ??

2008-04-30 Thread Andy
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/

Re: File manipulation

2004-11-29 Thread daggerquill
[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

Re: File manipulation

2004-11-23 Thread FlashMX
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

Re: File manipulation

2004-11-23 Thread Chris Devers
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

File manipulation

2004-11-23 Thread FlashMX
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

Re: Help needed on File manipulation

2003-09-26 Thread Dan Anderson
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

Help needed on File manipulation

2003-09-26 Thread Chinku Simon
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

Re: Help on file manipulation

2003-08-28 Thread zsdc
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

Help on file manipulation

2003-08-28 Thread Silja Rajendran
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

Re: File Manipulation Program

2003-02-24 Thread Jenda Krynicky
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

RE: File Manipulation Program

2003-02-24 Thread Poon, Kelvin (Infomart)
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

Re: File Manipulation Program

2003-02-24 Thread Bernhard van Staveren
[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

File Manipulation Program

2003-02-24 Thread Poon, Kelvin (Infomart)
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

file manipulation

2002-05-13 Thread Anjana Banerjee
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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-12 Thread Randal L. Schwartz
> "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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread drieux
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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> >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

Re: [OT] Re: Text file manipulation

2002-05-10 Thread Chas Owens
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

[OT] Re: Text file manipulation

2002-05-10 Thread drieux
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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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

Re: perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> > 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

Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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.

perldoc use Mostly::Readable - Re: Text file manipulation

2002-05-10 Thread drieux
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

Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> > 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

Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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: >

Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> >>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

Re: Text file manipulation

2002-05-10 Thread Tanton Gibbs
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

Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> 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 ___

Re: Text file manipulation

2002-05-10 Thread Tanton Gibbs
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

Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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

Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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:/

Re: Text file manipulation

2002-05-10 Thread Jeff 'japhy' Pinyan
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

RE: Text file manipulation

2002-05-10 Thread Ned Cunningham
] 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

Re: Text file manipulation

2002-05-10 Thread Jonathan E. Paton
> 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

Re: Text file manipulation

2002-05-10 Thread Tanton Gibbs
# 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

Text file manipulation

2002-05-10 Thread Hughes, Andrew
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

Re: Table Access OR File Manipulation

2002-02-19 Thread Jenda Krynicky
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

Re: Table Access OR File Manipulation

2002-02-19 Thread Gyro
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

Table Access OR File Manipulation

2002-02-19 Thread Ho, Tony
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

Re: PERL / UNIX File manipulation

2001-08-17 Thread Elaine -HFB- Ashton
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_

PERL / UNIX File manipulation

2001-08-17 Thread David Gilden
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