perl -nle '}{print $.' file
Count words:
perl -lane '$c+=@F}{print $c' file
Count files matching a pattern:
perl -le '$_=()=glob(pop);print' '246.56*'
See perlrun for command line switches. See glob. I'll explain that all if you want to know.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In reply to Re: Perl - 'count word'
by shmem
in thread Perl - 'count word'
by Noame
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |