#!/usr/bin/perl # format-paragraph # Author: Shankar Chakkere # Date: Nov 26 1996 # Status: working # Abstract: This script will remove crlf from the paragraph, so the # converted text can be easily formatted under word processor. The # lines of text between two blank lines is considered a paragraph. # Copyright (C) 1999 Shankar Chakkere # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Visit http://www.fsf.org for more information ######################################################################## ($#ARGV == 0 ) || &usage; # $#ARGV -1 when no command line parameter if (! open(FILE, "@ARGV[0]")) { warn "Cant open $file:\n"; exit; } while () { chop($_); #remove crlf $length = length($_); if ($length == 0) { print "\n\n"; } else { print " $_"; # A space is added so that the last char on the # current line and the first char on the next line # do not join hand !!. } } close FILE; sub usage { die <