> -----Original Message-----
> From: Chris Devers [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 14, 2004 4:16 PM
> To: Perl List (E-mail)
> Cc: Dave Kettmann
> Subject: Re: Perl equivalent to the unix 'cut' command
> 
> 
> On Thu, 14 Oct 2004, Chris Devers wrote:
> 
> > On Thu, 14 Oct 2004, Dave Kettmann wrote:
> > 
> > > Subject speaks for itself..
> > 
> > Okay then.
> > 
> >     perldoc -f split
> > 
> > Also speaks for itself :-)
>  
> To be less snarky, you probably need to open up your file, 
> iterate over 
> it line by line, using split to break each line up into chunks, then 
> write out a new array with the fields you want and the order you want 
> them. This second array can then be written out to disc; if 
> you want you 
> could even read & write within the same loop.
> 
> But the key point is that split is often the easiest way to 
> break apart 
> the fields in a file that is, for example, CSV formatted. 
> 
> Give that a try, write some code to attempt it, and let the 
> list know if 
> you have any problems in getting it to work.
> 
> 
> -- 
> Chris Devers
> 

Chris,

The reply was deserved :) Just another question before I go too far with this... The 
files I am parsing (just needing 2 tabbed fields out of them) are approximately 20,000 
- 25,000 lines long a piece. Each of these files will be globbed into one file, but 
that is something completely different. I guess my question is, would I be better off 
calling exec(cut) with files of this size for ease of use?  Guess I should have 
mentioned this in my previous email.

Thanks again,

Dave

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to