Re: looking at rows in text files

2001-07-18 Thread Jos I. Boumans
I think you need to start reading on a few books my friend. here are a few places to start: read the regexp tutorial i wrote at http://japh.nu read "perldoc perlre" for more details look into getting "learning perl" by randal schwartz, it will teach you many of the basics you'll need for Perl n

Re: looking at rows in text files

2001-07-18 Thread Tyler Longren
t;[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 2:25 PM Subject: Re: looking at rows in text files > using 'my' within the while loop will make it lose it's value once the loop > exi

Re: looking at rows in text files

2001-07-18 Thread Jos I. Boumans
using 'my' within the while loop will make it lose it's value once the loop exits and it will be reset every time you read in a new line declare 'my @list' above the loop, and you'll not have that problem. for readabillity, use: if(/(\S+/){ push @list, $1 } altho that's a bit superfluous i think,

Re: looking at rows in text files

2001-07-18 Thread Tyler Longren
t print anything to the screen. Really, thank you! - Original Message - From: "Jos I. Boumans" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 1:29 PM Subject: Re: looking at row

Re: looking at rows in text files

2001-07-18 Thread Jos I. Boumans
it's essentially the same thing, only instead of handing the match to the print operator, we store it in @list like so: open(FP, "$tempfile"); # Open $tempfile for reading while() { push @list, /(\S+)/ } $list[0] will hold the first match, $list[1] the 2nd and so forth hope this helps, Jos >

Re: looking at rows in text files

2001-07-18 Thread Will Cottay
If your file really looks like that and you're really only trying to print the first column just: cut -d' ' -f1 < your.file from the command prompt. or if you want the dns server name instead: tr -s '[:blank:]' '\t' < cu.txt | cut -f2 -will Tyler Longren wrote: > > Hello everyone, > > I h

Re: looking at rows in text files

2001-07-18 Thread Jos I. Boumans
a short way: open I, "file.txt" or die $!; while () { print /(\S+)/ } hope this helps, Jos Boumans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: looking at rows in text files

2001-07-18 Thread Sascha Kersken
gt; >An: "Perl Beginners" <[EMAIL PROTECTED]> >Betreff: looking at rows in text files >Datum: Mit, 18. Jul 2001 15:43 Uhr > > Hello everyone, > > I have a file that contains a few domain names, and their dns servers (kind > of like a zonefile). Here's the

Re: looking at rows in text files

2001-07-18 Thread Aaron Craig
How about: use strict; open(IN, "file.txt") || die("RRRGGGHHH $!"); while() # loop through file setting each line to $_ { chomp; # lose newline /^([^\s]+)\s/; # look for anything at the beginning of the string up to the first space or tab character and remembe

looking at rows in text files

2001-07-18 Thread Tyler Longren
Hello everyone, I have a file that contains a few domain names, and their dns servers (kind of like a zonefile). Here's the format: my.comdns1.blah.com me.comdns1.blah.com we.comdns1.blah.com you.com dns1.blah.com How can I get ONLY the domain's out of that file, and print each do