• 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: Setting contents of a large file to a variable.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting contents of a large file to a variable.


  • Subject: Re: Setting contents of a large file to a variable.
  • From: Dan Belfiori <email@hidden>
  • Date: Thu, 25 Nov 2004 06:55:16 -0800


On Nov 25, 2004, at 12:36 AM, Rob Stott wrote:


The easiest change to your existing script would be to process the file in
chunks.


Andrew's method works and is the way most folks get round this in AppleScript. Depending on what you want to do, it may also be worth your while investigating how to use 'do shell script' to manipulate a text file (read up on Unix commands, cat, grep, tr and sed).


The advantage of shell scripts is that you edit the text file instead of trying to read, edit and rewrite it. I know very little of unix commands...but this one did it for me.

perl -pi -e s/OldText/NewText/g file.txt

It uses perl to find and replace text in a text file. It took some experimenting to get the above command formuated into a applescript string variable so it would succeed as a shell script.
-db


_______________________________________________
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: Setting contents of a large file to a variable.
      • From: Christopher Nebel <email@hidden>
References: 
 >Re: Setting contents of a large file to a variable. (From: Andrew Oliver <email@hidden>)
 >Re: Setting contents of a large file to a variable. (From: Rob Stott <email@hidden>)

  • Prev by Date: Re: I am a subscriber
  • Next by Date: iCal - New Attendee
  • Previous by thread: Re: Setting contents of a large file to a variable.
  • Next by thread: Re: Setting contents of a large file to a variable.
  • Index(es):
    • Date
    • Thread