ASP 101 - Active Server Pages 101 - Web03
The Place ASP Developers Go!



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash





Script Output:
Search For:

Searching Text File "../samples/textfilesearch.txt" for "":
Name              Sales
-----------------------
David Andersen    6420
Steven Buchanan   3245
Laura Callahan    3675
Nancy Dodsworth   2750
Frank Edwards     3840
Andrew Fuller     5000
Chris Graham      4050
Peter Hopkins     6710
Owen Ingraham     4750
Edward Jones      3450
Robert King       5290
Janet Leverling   6250
Greg Miller       5640
Beth Nelson       4345
Ian Ostrander     3965
Margaret Peacock  4685
Howard Quinn      5865
Kate Richards     4260
Fred Smith        6370
Tammy Steel       3570
Vincent Thompson  4820
Debra Underwood   3790
Linda Valentino   2965
Mark White        4500
Simon Xavier      5580
Quincy Youngs     4420
Walter Zimmerman  4980

The text searched for was found on the following lines in the file:


ASP HTML Download            FAQ

ASP.NET Version

This sample shows you how to search a text file for a phrase. As it is currently implemented, it displays the complete file being searched with the search phrase highlighted and lists the line numbers on which the search phrase was found at the bottom. The search is case sensitive and seems to work quite quickly. I've tested it on files with up to 10,000 lines and about 250 KB and the results still come back pretty darn fast.

One final note... although we list the line numbers on which the text is found, we don't actually keep track of the number of occurances of the search phrase found in the file. If the text is on the same line multiple times, the line number is still listed just once.

You can view the plain text file being searched here: ../samples/textfilesearch.txt


Samples

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers