At 16:46 -0400 2001.07.31, Adam Witney wrote:
>I have a file which contains about 45000 lines of 50 characters each. I want
>to reformat it to contain 60 characters each.
>
>I can read the whole file in and remove the line endings and then print out
>lines of 60 characters, but this can take some time. And I may need to do
>this on bigger files still.
>
>Is there a quicker way?

I would look into the -p switch.  Given your input file in $ARGV[0]:

#!/usr/bin/perl -pi.orig
chomp;
$_ .= "0123456789\n";
__END__

It will loop over the file, reading each line and writing out to a file of
the same name (but backing up the original to file.orig).

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to