• 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: Modifying text in a large file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying text in a large file


  • Subject: Re: Modifying text in a large file
  • From: Steve Mills <email@hidden>
  • Date: Mon, 20 Oct 2003 09:35:15 -0500

On Monday, Oct 20, 2003, at 08:27 US/Central, christian vick wrote:

I want to search a string and then replace the entire line with another
string (or delete the line). This in a large text file (50 MB). If I use
'read file' the script errors with 'out of memory', so vanilla AS is not an
option here. I've searched Terminal 'apropos search'/'apropos replace', but
didn't find anything useful. Does someone know how to do it via command
line, so i can use 'do shell script'...?

Why not search only a hunk of the file at a time, say 32k or something like that? Read 32k, search it, then read 32k again except you'll need to move the file position back (length of searchString - 1), repeat.

Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Modifying text in a large file (From: christian vick <email@hidden>)

  • Prev by Date: Re: Address Book->check for existing record before adding
  • Next by Date: Re: Scripting CLI apps
  • Previous by thread: Modifying text in a large file
  • Next by thread: Re: Modifying text in a large file
  • Index(es):
    • Date
    • Thread