Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: perl

by Fastolfe (Vicar)
on Nov 10, 2000 at 00:45 UTC ( #40814=note: print w/ replies, xml ) Need Help??


in reply to perl

A one-liner that will do this:

perl -ne '$count++ unless /\S/; print "$count\n" if eof' <filename


Comment on Re: perl
Download Code
Replies are listed 'Best First'.
Re^2: perl
by Random_Walk (Prior) on Sep 03, 2004 at 07:49 UTC
    A slightly shorter version perl -pe '$c++ unless /\S/}{$_=$c' Cheers,
    Random.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-09-03 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred temperature scale is:










    Results (107 votes), past polls