Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count number of lines in notepad 4

Status
Not open for further replies.

juniper911

Technical User
Mar 7, 2007
181
GB
Hello All

Can anyone provide me a script that can count how many lines there are in a txt file? I've googled for a while
but cannot find the one I need and the ones I did find do not work! I do not know enough about scripting to make them work!

All help greatly appreciated!

Cheers

J
 
textpad is a free product that will count the line for you (actually shows them down the left side



________________________________________
Achieving a perception of high intelligence level can only be limited by your manipulation skills of the Google algorithm!
 
In the application; choose view, then Line numbers.

________________________________________
Achieving a perception of high intelligence level can only be limited by your manipulation skills of the Google algorithm!
 
I am using notepad and have to use Notepad!

This is on Windows 2000, the notepad in 2003 has view line number options.
 
I was referring to the TextPad application. Notepad 2003/XP does not have line numbering. Why must you only use notepad? Once textpad is installed, you can default to it.

________________________________________
Achieving a perception of high intelligence level can only be limited by your manipulation skills of the Google algorithm!
 
In notepad, make sure line wrap is turned OFF.

Press Control G or choose Edit Go To from the menu.

When prompted for a line number to Go To, select a number way too high, for example 1000.

You will receive an error ("Line Number Out Of Range") and the line number will change to the last line number in the text document.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
A script? SOmething like:
Code:
[blue]wscript.Echo UBound(Split(CreateObject("Scripting.FileSystemObject").opentextfile(Wscript.Arguments.Item(0)).ReadAll, vbLf))[\blue]\code]

This particualr example can be saved as, say, linecount.vbs and called from a commandline as

linecount <filename>
 
Thx markdmac! Learn something new everyday. star

________________________________________
Achieving a perception of high intelligence level can only be limited by your manipulation skills of the Google algorithm!
 
Markdmac - its spot on thanks!

If I could award points, you'd get 27 ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top