in reply to Display Line Numbers
Or you may be asking how to determine what line number you've just read out of a file. If that's the case, the "$." special variable will tell you what line number you're reading. See perlvar for details.
Or you may be asking how to determine what line in your script is currently executing. If that's the case, the __LINE__ tag will tell you. You can print __LINE__, "\n";, for example. See perldata for details about the __LINE__ "Special Literal".
Or if you just want to know how many lines there are in a file.... well, here's a Perl solution:
perl -n -e "END { print $., "\n"; }" file.txt
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Display Line Numbers
by TekWannaBe (Initiate) on Jan 30, 2004 at 18:26 UTC | |
by talexb (Chancellor) on Jan 30, 2004 at 18:32 UTC | |
by TekWannaBe (Initiate) on Jan 30, 2004 at 23:29 UTC |