in reply to Re: How To Count Lines In File?
in thread How To Count Lines In File?
?perl -lpe '}{$_=$.' file
On another similar note, last semester my C++ students had to write a small C++ program that averages numbers from a flatfile (one per line). I wowed them with this little doosie:
UPDATEperl -lpe '$s+=$_}{$_=$s/$.' file
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How To Count Lines In File?
by Abigail-II (Bishop) on Jan 27, 2003 at 21:46 UTC | |
by Anonymous Monk on Jan 27, 2003 at 22:19 UTC | |
by sauoq (Abbot) on Jan 27, 2003 at 23:48 UTC |