Finding lines containing foo in a file
Finding lines containing foo in a file
- Subject: Finding lines containing foo in a file
- From: "Stockly, Ed" <email@hidden>
- Date: Tue, 20 Dec 2005 17:05:39 -0800
Hey AppleScript list,
I have an efficiency question. I have a biggish file >(50,000 words, 700,00 chars, 1,000 lines)
I need to get every line that contain specific strings.
For example, if this were the handler call:
my GetLinesFromFile ({"25307", "29375", "30099", "31331", "32167"}, filePath)
the result should be a list of 5 items where each item was a line of text from the file containing the corresponding string.
I am currently doing this by reading the file, getting the offset of each string, finding the line number from its position in the text and extracting the line using text item delimiters.
There has to be a better/faster way!
Any vanilla AppleScript* suggestions?
Ed
* By 'vanilla AppleScript' I mean a standard OS X install with no third party extensions or applications.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden