[OLUG] printing issue

Adam Korab adam at ledhazard.net
Wed Feb 16 18:55:49 UTC 2000


On Wed, Feb 16, 2000 at 11:30:04AM -0600, Chad S. Lauritsen wrote:
> I think the stair-stepping text is caused by a lack of a carriage return
> with the linefeed at the end of each line. A simple perl or sed filter
> hack may fix it. e.g., to print the hosts file using perl:

Here's a small perl script that accomplishes the same thing -- basically
seems to work the same as your shell script:

#!/usr/local/bin/perl

$input = @ARGV[0];
$temp_file = "/var/tmp/embed.tmp";
open(TEMP, ">$temp_file") || die "Could not open $file\n";

if ($input ne "") {
        open (INFILE, "$input") || die "Could not open $input\n";
        while (<INFILE>) {
                $line = join('', $_, "^M");
                print TEMP $line;
        }
        close INFILE;
}
else {
        while (<>) {
                $line = join('', $_, "^M");
                print TEMP $line;
        }
}

close TEMP;

--Adam
-- 
|--------------------------------------------------------------------|
| ThisemailbroughttoyoubyJOLTcola,favored   |                        |    
| bysysadmins,netadminsandprogrammers       |   adam at ledhazard.net   |
| everywhere.JOLTcola--forallthesugarand    |                        | 
| twicethecaffeine.(R)                      |                        |
|--------------------------------------------------------------------|


-------------------------------------------------------------------------
Sent by OLUG Mailing list Manager, run by ezmlm.  http://olug.bstc.net/ 
To unsubscribe: `echo unsubsribe | mail olug-unsubscribe at bstc.net` 



More information about the OLUG mailing list