end of line

2006-02-19 Thread Bowen, Bruce
I have a text file with lines of varying length. 000,;,001,WL0,001,001,000,000,000,000 011,@D ,011,000,001,050,050,105,105,004,004,064,255,000,001,116,255,255,255,106,255,255,255,255,116,255,255,255 012,D,038,032,000,002,000,001,000,000 013,@D ,013,000,001,050,050,105,105,004,004,064,255,000,00

end of line problems

2001-09-07 Thread Ron Woodall
all of the lines are run together. It is as if I've got the wrong end of line character but I can't seem to find the correct one to use. I'm using "\n" in my code and I've modified "$/" to "=" and back to "\n". When I view the source in Ne

find .| end of line

2006-12-19 Thread Jack Daniels (Butch)
Having a heck of a time Windows server Want to find all lines with .| at end of line Also, how would I replace .| with | My problem is when using \ to make | a regular character, it never works. file contains lines in this format joe|TK123 .23 .B22 2004| joe|TK123 .23 .B22 2004.| -- To

End of line character

2005-06-01 Thread Dermot Paikkos
Hi, perl5 (revision 5 version 8 subversion 5) on redhat fedora 3 I have been trying to create a list of home directories from a list. The directory name comes straight from the list but I seem to be getting a odd end of line character from each item on the list and this gets added to the

Re: end of line

2006-02-19 Thread Owen Cook
On Sun, 19 Feb 2006, Bowen, Bruce wrote: > I have a text file with lines of varying length. > > 000,;,001,WL0,001,001,000,000,000,000 > 011,@D > ,011,000,001,050,050,105,105,004,004,064,255,000,001,116,255,255,255,106,255,255,255,255,116,255,255,255 > 012,D,038,032,000,002,000,001,000,000 > 01

Re: end of line

2006-02-19 Thread Xavier Noria
On Feb 19, 2006, at 23:32, Bowen, Bruce wrote: I have a text file with lines of varying length. 000,;,001,WL0,001,001,000,000,000,000 011,@D , 011,000,001,050,050,105,105,004,004,064,255,000,001,116,255,255,255,10 6,255,255,255,255,116,255,255,255 012,D,038,032,000,002,000,001,000,000 013,@D

Re: end of line

2006-02-19 Thread John W. Krahn
Bowen, Bruce wrote: > I have a text file with lines of varying length. Most text files are like that. > 000,;,001,WL0,001,001,000,000,000,000 > 011,@D > ,011,000,001,050,050,105,105,004,004,064,255,000,001,116,255,255,255,106,255,255,255,255,116,255,255,255 > 012,D,038,032,000,002,000,001,000,0

Re: end of line

2006-02-19 Thread Xavier Noria
On Feb 20, 2006, at 0:39, Bowen, Bruce wrote: A possible idiom is: my @lines = <>; # slurp all lines my @wanted = grep { m'012,D|011,@D' } @lines; * I tried open STATE, "STATEFILE.txt" or die my @lines = ; my $state = grep {m"011

regexp - end of line question

2008-11-20 Thread sftriman
I have data such as: A|B|C|44 X|Y|Z|33,44 C|R|E|44,55,66 T|Q|I|88,33,44 I want to find all lines with 44 in the last field. I was trying: /[,\|]44[,\$]/ which logically is perfect - but the end of line \$ doesn't seem right. How do I write: comma or pipe followed by 44 followed by com

Traversing upto end of line

2008-02-07 Thread vijay krishna
Hi, This might just be a little too trivial. I was just wondering if someone could give me a condition where I can traverse across a complete string and perform operation until I encounter End of Line. This is what I tried: if($string != \n) { do operations; } But this does not seem to

Re: find .| end of line

2006-12-19 Thread Mumia W.
On 12/19/2006 05:45 AM, Jack Daniels (Butch) wrote: Having a heck of a time Windows server Want to find all lines with .| at end of line Also, how would I replace .| with | My problem is when using \ to make | a regular character, it never works. file contains lines in this format joe|TK123

RE: End of line character

2005-06-01 Thread Thomas Bätzler
Dermot Paikkos <[EMAIL PROTECTED]> coded: [...] > #!/bin/perl > > my $root = "/home/"; > my $file = "home.txt"; > open(FH,$file) or die "Can't open $file: $!\n"; > > while () { > chomp; s/\s*$//; # delete all whitespace at the end of the string > my $n = "$root"."$f"

Re: End of line character

2005-06-01 Thread John W. Krahn
Thomas Bätzler wrote: Dermot Paikkos <[EMAIL PROTECTED]> coded: [...] #!/bin/perl my $root = "/home/"; my $file = "home.txt"; open(FH,$file) or die "Can't open $file: $!\n"; while () { chomp; s/\s*$//; # delete all whitespace at the end of the string You should use \s+

RE: End of line character

2005-06-01 Thread Charles K. Clarkson
Thomas Bätzler wrote: : Dermot Paikkos <[EMAIL PROTECTED]> coded: : [...] : : #!/bin/perl : : : : my $root = "/home/"; : : my $file = "home.txt"; : : open(FH,$file) or die "Can't open $file: $!\n"; If you leave the "\n" off the end of the die(), you will see valuabl

[Summary]: End of line character

2005-06-01 Thread Dermot Paikkos
Thanx to Thomas for the quick response and answer. s/\s*$//; # delete all whitespace at the end of the string This was all that was necessary, although I like the qq tip as well. Dp. On 1 Jun 2005 at 11:27, Thomas Bätzler wrote: > Dermot Paikkos <[EMAIL PROTECTED]> coded: > [...] > > #!/bin/

Re: End of line character

2005-06-01 Thread John Doe
Am Dienstag, 31. Mai 2005 11.06 schrieb Dermot Paikkos: > Hi, > > perl5 (revision 5 version 8 subversion 5) on redhat fedora 3 > > I have been trying to create a list of home directories from a list. > The directory name comes straight from the list but I seem to be > gett

Help with end of line charaters

2004-02-22 Thread Westcott Andrew-AWESTCO1
Hi, I'm new to perl but need to write a script that takes a file and formats lines. The file has to 2 fields that are tab separated and each field is made up of items separated by some type of linefeed character. The end of the second field is identified by another type of linefeed character.

Re: regexp - end of line question

2008-11-20 Thread John W. Krahn
sftriman wrote: I have data such as: A|B|C|44 X|Y|Z|33,44 C|R|E|44,55,66 T|Q|I|88,33,44 I want to find all lines with 44 in the last field. I was trying: /[,\|]44[,\$]/ which logically is perfect - but the end of line \$ doesn't seem right. How do I write: comma or pipe followed

Re: Traversing upto end of line

2008-02-07 Thread Chas. Owens
On Feb 7, 2008 10:53 PM, vijay krishna <[EMAIL PROTECTED]> wrote: > Hi, > This might just be a little too trivial. > I was just wondering if someone could give me a condition where I can > traverse across a complete string and perform operation until I encounter End &g

Re: Traversing upto end of line

2008-02-07 Thread John W. Krahn
vijay krishna wrote: Hi, Hello, This might just be a little too trivial. I was just wondering if someone could give me a condition where I can traverse across a complete string and perform operation until I encounter End of Line. This is what I tried: if($string != \n) { do

Re: [Summary]: End of line character

2005-06-01 Thread Jeff 'japhy' Pinyan
On Jun 1, Dermot Paikkos said: s/\s*$//; # delete all whitespace at the end of the string Except that it's awfully silly-looking. I'd *at least* do s/\s+$//; which is monumentally faster, although not perfect. -- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Aca

RE: Help with end of line charaters

2004-02-22 Thread David le Blanc
> From: Westcott Andrew-AWESTCO1 [mailto:[EMAIL PROTECTED] > Sent: Sunday, 22 February 2004 10:08 PM > To: '[EMAIL PROTECTED]' > Subject: Help with end of line charaters > > Hi, > > I'm new to perl but need to write a script that takes a file > an

Re: Help with end of line charaters

2004-02-22 Thread R. Joseph Newton
Westcott Andrew-AWESTCO1 wrote: > Hi, > > I'm new to perl but need to write a script that takes a file and formats > lines. > > The file has to 2 fields that are tab separated and each field is made up of > items separated by some type of linefeed character. The end of the second > field is identi

RE: Help with end of line charaters

2004-02-23 Thread David le Blanc
> -Original Message- > From: R. Joseph Newton [mailto:[EMAIL PROTECTED] > Sent: Monday, 23 February 2004 4:50 PM > To: Westcott Andrew-AWESTCO1 > Cc: '[EMAIL PROTECTED]' > Subject: Re: Help with end of line charaters > > Westcott Andrew-AWESTCO1 wrote:

Re: Help with end of line charaters

2004-02-23 Thread Rob Dixon
Andrew Westcott wrote: > > I'm new to perl but need to write a script that takes a file and formats > lines. > > The file has to 2 fields that are tab separated and each field is made up of > items separated by some type of linefeed character. The end of the second > field is identified by another

Re: Help with end of line charaters

2004-02-23 Thread Rob Dixon
R. Joseph Newton wrote: > > Maybe you should do a binary/text dump of the file. Chose a set of meanguful > printing characters to print as character, printi anything outside of this range > as hex. Something like: I like that: 'meanguful'. I shall have to try to fir it into my conversation :) >

Re: Help with end of line charaters

2004-02-23 Thread Rob Dixon
David Le Blanc wrote: > > > use Dumper::HexDump; That's Data::HexDump :) > print HexDump( $whole_durn_thang ); > > Makes for very pretty output, if you like that sort of thing.. > > You may need to put Dumper::HexDump from CPAN > (as in : > % perl -MCPAN -e shell > cpan> install Dumper::HexDu

RE: Help with end of line charaters

2004-02-23 Thread Westcott Andrew-AWESTCO1
ECTED] Subject: Re: Help with end of line charaters Westcott Andrew-AWESTCO1 wrote: > Hi, > > I'm new to perl but need to write a script that takes a file and formats > lines. > > The file has to 2 fields that are tab separated and each field is made up of > items separated by

Re: Help with end of line charaters

2004-02-23 Thread Rob Dixon
Andrew Westcott wrote: > > You have solved my problem, the key was in your script. I had not been > reading the file in binary mode and so the different LF and CR where getting > lost. > > Thanks > > I did run the script you sent which was very help full and I will store that > away as I'm sure it

Re: Help with end of line charaters

2004-02-23 Thread R. Joseph Newton
Rob Dixon wrote: > R. Joseph Newton wrote: > > > > Maybe you should do a binary/text dump of the file. Chose a set of meanguful > > printing characters to print as character, printi anything outside of this range > > as hex. Something like: > > I like that: 'meanguful'. I shall have to try to fi

Re: Help with end of line charaters

2004-02-23 Thread R. Joseph Newton
Westcott Andrew-AWESTCO1 wrote: > Hi, > > You have solved my problem, the key was in your script. I had not been > reading the file in binary mode and so the different LF and CR where getting > lost. > > Thanks > > I did run the script you sent which was very help full and I will store that > away

Re: Help with end of line charaters

2004-02-23 Thread R. Joseph Newton
Rob Dixon wrote: > > OK, but you still haven't solved the problem. Joseph's intent was > to show you how to examine the raw data, but I doubt he would > expect you to process a text file in that way. > ... > I really hope that this doesn't fall on deaf ears. So many > people grab hold of anything

how to delete space at end of line

2002-11-29 Thread Joseph Paish
i have a data file that i am reading into an array. some of the data file entries have a space at the end of the line and some do not. is there some way that i can delete the space if it exists as i read each line (something like chomp deletes newlines if they exist)? preferably something leg

RE: how to delete space at end of line

2002-11-29 Thread Duarte Cordeiro
o: perl_beginner > Subject: how to delete space at end of line > > > i have a data file that i am reading into an array. some of > the data file > entries have a space at the end of the line and some do not. > is there some > way that i can delete the space if it exists a

Re: how to delete space at end of line

2002-11-29 Thread badchoice
@==map$`x/ ?$/,<> maintainable? sure ;-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: how to delete space at end of line

2002-11-29 Thread John W. Krahn
Joseph Paish wrote: > > i have a data file that i am reading into an array. some of the data file > entries have a space at the end of the line and some do not. is there some > way that i can delete the space if it exists as i read each line (something > like chomp deletes newlines if they exist

Re: how to delete space at end of line

2002-12-01 Thread Joseph Paish
On Friday 29 November 2002 14:28, you wrote: > Joseph Paish wrote: > > i have a data file that i am reading into an array. some of the data > > file entries have a space at the end of the line and some do not. is > > there some way that i can delete the space if it exists as i read each > > line

RE: how to delete space at end of line

2002-12-01 Thread Beau E. Cox
Re: how to delete space at end of line On Friday 29 November 2002 14:28, you wrote: > Joseph Paish wrote: > > i have a data file that i am reading into an array. some of the data > > file entries have a space at the end of the line and some do not. is > > there some way tha

Re: how to delete space at end of line

2002-12-01 Thread John W. Krahn
Joseph Paish wrote: > > thanks to all that replied. > > i guess i have to learn my way around regular expressions now. i've managed > to go this long without studying them because i find them to be cryptic (to > say the least). at least this one is fairly simple, and by deconstructing it > piec

RE: how to delete space at end of line

2002-12-01 Thread Brian Engleton
Joe, >From one Perl newbie to another, buy "Mastering Regular Expressions" by Friedl. It's an O'reilly book. It is vey well written, and readable, I've actually enjoyed reading it (believe it or not)! It really helps take the mystery out of regexes. Try it out brian i guess i have to learn

CR at end of line - how do I parse this?

2003-07-08 Thread Fuchs, Christopher
Hello All: I have a perl script on UNIX which works properly for an ASCII input data file which is in the form of: record 1 line 1 record 1 line 2 record 1 line 3^M record 2 line 1 etc The record delimiter is ^M (which is sometimes refered to as CR or \r). When run on a Windows box, the ^M is s

Re: CR at end of line - how do I parse this?

2003-07-08 Thread Rob Dixon
Christopher Fuchs wrote: > Hello All: > > I have a perl script on UNIX which works properly for an ASCII > input data file which is in the form of: > > record 1 line 1 > record 1 line 2 > record 1 line 3^M > record 2 line 1 > etc > > The record delimiter is ^M (which is sometimes refered to as CR o

Re: CR at end of line - how do I parse this?

2003-07-08 Thread Janek Schleicher
Christopher Fuchs wrote at Tue, 08 Jul 2003 14:29:50 -0700: > I have a perl script on UNIX which works properly for an ASCII > input data file which is in the form of: > > record 1 line 1 > record 1 line 2 > record 1 line 3^M > record 2 line 1 > etc > > The record delimiter is ^M (which is somet

Re: CR at end of line - how do I parse this?

2003-07-09 Thread Fuchs, Christopher
>> How do I get Perl/Windows to keep the ^M so I can parse this? >binmode is your friend. Yes binmode was what I was missing. Thanks for everyone's help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reading file line by line regardless of type of end-of-line?

2001-08-03 Thread Sherlock Holmes
I would like to create a perl script that reads lines from an ascii file, but that reads them regardless of whichever of the three variants (, or ) is actually in use as end-of-line, *without* knowing beforehand which is the case. The script should run on many systems (so installing a

RE: Reading file line by line regardless of type of end-of-line?

2001-08-03 Thread Steve Howard
unless ($_ eq ''); } Like I said, ugly, but it will work and give you a consistent file format to work with in the second loop Steve -Original Message- From: Sherlock Holmes [mailto:[EMAIL PROTECTED]] Sent: Friday, August 03, 2001 7:33 AM To: [EMAIL PROTECTED] Sub

Re: Reading file line by line regardless of type of end-of-line?

2001-08-03 Thread Michael Fowler
On Fri, Aug 03, 2001 at 01:40:30PM -0700, [EMAIL PROTECTED] wrote: > > Michael Fowler <[EMAIL PROTECTED]> said: > > > You left out the Macintosh EOL sequence, , and I don't know what > > uses simply as EOL. > > Macs use just . No machine that I know of uses as a line > terminator. Right, th

Re: Reading file line by line regardless of type of end-of-line?

2001-08-05 Thread Arthur Klassen
[EMAIL PROTECTED] wrote: > > > Michael Fowler <[EMAIL PROTECTED]> said: > > > You left out the Macintosh EOL sequence, , and I don't know > > what uses simply as EOL. > > Macs use just . No machine that I know of uses as a line > terminator. I don't know this from experience, but I remember

Re: Reading file line by line regardless of type of end-of-line?

2001-08-05 Thread Mel Matsuoka
At 07:11 AM 08/04/2001 -0700, Arthur Klassen wrote: >[EMAIL PROTECTED] wrote: >> >> > Michael Fowler <[EMAIL PROTECTED]> said: >> >> > You left out the Macintosh EOL sequence, , and I don't know >> > what uses simply as EOL. >> >> Macs use just . No machine that I know of uses as a line >> t

Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Siegfried Heintze
How do I search for the word "intern" without searching for "internal"? What I have been doing is /intern[^a]/ but that won't match /intern$/. Thanks, Siegfried

Re: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Jeff 'japhy' Pinyan
On Jun 2, Siegfried Heintze said: How do I search for the word "intern" without searching for "internal"? What I have been doing is /intern[^a]/ but that won't match /intern$/. You want to use a negative look-ahead: /intern(?!al)/ That means "match 'intern' that is not followed by 'al'".

RE: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Siegfried Heintze
e an easier way? Thanks, Siegfried -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED] Sent: Thursday, June 02, 2005 7:04 PM To: Siegfried Heintze Cc: beginners@perl.org Subject: Re: Seaching for Words at the beginning of the line and end of line On Jun 2, Siegfried

RE: Seaching for Words at the beginning of the line and end of line

2005-06-02 Thread Jeff 'japhy' Pinyan
On Jun 2, Siegfried Heintze said: s/\bJr\b/ Junior /gi; This is not exactly what I want because it will put a space before "Junior" even if Junior is at the beginning and I don't want a space? Just do s/\bJr\b/Junior/gi; The \b is an anchor -- it matches a location, not a character. -- J