Getting the number of lines in a text file
This may be something trivial, but it saves me some time…
Today I wrote a quick VB Script that will count the lines of a text file. This could be useful if you need to quickly verify that some program is outputting the right number of lines to a target file. You can also place it in your windows path location. Then just type “lines filex” from the command prompt to instantly tell how many lines exist in a file (where filex is the name of your file).
I have tested the script on XP Pro SP2 and Vista Home Premium Service Pack 1
Anyway, I find it useful while working on test cases at work. Sometimes, its the little things that save you lots of time.
To use the script, simply drag and drop any text file to it. It will pop up with the number of lines.
Related posts:
- Text editing made cooler! If you are a web site developer, you know how important it is to make your users feel comfortable in using your applications. It is always nice to provide the...
- How do I use an MD5 checksum? If you followed the links on my last post, one of them would have taken you to the Torpark web browser download page. When downloading Torpark, you are given an...
- Learning about Applets Web programming can be as simple or as complex as you want it to be. The easiest web publication is a simple text file. You could upload it to the...



Like or Dislike:
0
0
Anonymous
31 Dec 69 at 18:00
That cool. I still prefer to count the lines in a file manually because it just helps my counting ability so much.
Like or Dislike:
0
0
Trevor Pearson
9 Oct 08 at 02:08
ugh VBscript makes my brain hurt… C# all the way!
Like or Dislike:
0
0
Chris Mau
9 Oct 08 at 08:49
I was seriously looking everywhere to find out how I can parse a text file to get the input. I tried writing a script using php, it didn’t work. This approach looks like a great solution. Now I have an idea on how to tie things into my design. Thanks for sharing!
Like or Dislike:
0
0
Dave
13 Jan 09 at 14:13
awesome script, extremely helpful. thank you!
Like or Dislike:
0
0
pinkISH
27 Feb 09 at 17:48