#!/usr/bin/perl $filename = $ARGV[0]; $SGMLFILE = "./${filename}new.sgm"; $NEWFILE = "./${filename}new2.sgm"; $maxLineLength = 1500; open SGMLFILE or die "can't open $SGMLFILE"; open NEWFILE, ">$NEWFILE" or die "can't open $NEWFILE"; while ($sgml_line = ) { $sgml_line =~ s/"ammem2.dtd"//; $sgml_line =~ s//icufaw-/; if ($sgml_line =~ m/ $maxLineLength) { $temp_line = $sgml_line; while (length($temp_line) > $maxLineLength) { $temp_line =~ m/(.{1,$maxLineLength})\s(.*)/; print NEWFILE "$1\n"; $temp_line = $2; } print NEWFILE "$temp_line\n"; } else { print NEWFILE $sgml_line; } } close SGMLFILE; close NEWFILE; exit(0);