in reply to peek - output a one-line preview of stdin
Let's add the ability to preserve the last line with
--keep
andmy $wide = 79; my $keep=0; my %options = ( 'wide|width=i' => \$wide, 'keep' => \$keep ); GetOptions(%options) or die;
while (<>) { chomp; tr{\n\t}{\r }; $_ = substr($_ . $pad, 0, $wide); print "$_\r"; } if(!$keep) {print "$pad\r";} else {print "\n";} exit(0);
|
---|
In Section
Code Catacombs