Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: peek - output a one-line preview of stdin

by Improv (Pilgrim)
on Apr 28, 2003 at 15:08 UTC ( #253718=note: print w/ replies, xml ) Need Help??


in reply to peek - output a one-line preview of stdin

Let's add the ability to preserve the last line with --keep

my $wide = 79; my $keep=0; my %options = ( 'wide|width=i' => \$wide, 'keep' => \$keep ); GetOptions(%options) or die;
and
while (<>) { chomp; tr{\n\t}{\r }; $_ = substr($_ . $pad, 0, $wide); print "$_\r"; } if(!$keep) {print "$pad\r";} else {print "\n";} exit(0);


Comment on Re: peek - output a one-line preview of stdin
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://253718]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2015-07-28 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls