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
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, ">output.txt" or die "Could not open output.txt: $!\n"; #output the output file for unique recs my %addys; # a hash to store the unique recs i