• 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
RE: Finding lines containing foo in a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Finding lines containing foo in a file


  • Subject: RE: Finding lines containing foo in a file
  • From: "Stockly, Ed" <email@hidden>
  • Date: Thu, 22 Dec 2005 15:39:28 -0800

	>>Deivy>>I believe that this is faster than an AS solution without do shell
> script.
>
I think you're right, this could be much faster, these files are so big it slows appleScript way down. When I run this command from the terminal it works instantaneously.

Here's the most recent version I've been testing:

<Script>
set AppleScript's text item delimiters to "|"
set itemstofind to quoted form of ({"32103", "31823", "31679"} as string)
set filepath to quoted form of POSIX path of ((choose file) as Unicode text)
set myShellScript to "tr  '\\r' '\\n' < " & filepath & " |" & "egrep " & itemstofind
(do shell script myShellScript)
</Script>
Here's the problem, when I run the script I get this error message:

-->	Can't make result of «script» into the expected type.

 But I can paste the text of the myShellScript variable directly into the terminal and it works flawlessly, reliably with several files and several strings, including not found strings.

Any Suggestions?

ES
 _______________________________________________
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: Deivy Petrescu <email@hidden>
  • Prev by Date: Re: Best practices for creating and comparing lists of text?
  • Next by Date: Re: Simple Repeat until loop problem
  • Previous by thread: Re: Finding lines containing foo in a file
  • Next by thread: Re: Finding lines containing foo in a file
  • Index(es):
    • Date
    • Thread