• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Finding lines containing foo in a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Finding lines containing foo in a file
      • From: Serge Ségu <email@hidden>
    • Re: Finding lines containing foo in a file
      • From: deivy petrescu <email@hidden>
  • Prev by Date: Re: scripting the Airport menu
  • Next by Date: Re: Finding lines containing foo in a file
  • Previous by thread: File type and encoding rates
  • Next by thread: Re: Finding lines containing foo in a file
  • Index(es):
    • Date
    • Thread