View Single Post
Old 07-29-2008, 10:25 AM   #5
monojohnny
Junior Member
monojohnny began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jul 2008
Device: Kindle
Thanks again for that , make sense.

Posting the final version of program here, in case its of some use to other people.

-- CUT HERE, save as 'convert.rb' --
# Simple Ruby script to convert text-format ebooks from Project Gutenberg
# To a format which is more readable on an Amazon Kindle.
#
# Run with 'ruby -an convert.rb <original.txt> > <new.txt>'
#
# links: http://www.gutenberg.org, http://www.ruby-lang.org
#

BEGIN { BLANKLINE=sprintf("\r\n"); }

if $_ == BLANKLINE then
printf("\n\t"); next;
else
chomp!
printf(" %s",$_);
end
-- CUT HERE --
monojohnny is offline   Reply With Quote