• 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: Long text file manipulation...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Long text file manipulation...


  • Subject: Re: Long text file manipulation...
  • From: "email@hidden" <email@hidden>
  • Date: Wed, 04 Apr 2001 17:42:22 +0200

Hi,


Christopher Stone gave me some very useful help with a similar problem.

Try the osax he suggested: http://www.lazerware.com/FTP/RECommands.hqx


He also wrote this script (see below), hope this helps.

//Peter



set goFlag to false
set srcFldr to alias "Black Hole:Src Test:"
set destFldr to alias "Black Hole:Dest Test:"

tell application "Finder"
set theFiles to files of srcFldr
end tell

try
repeat with i from 1 to count of theFiles
set aFile to open for access (item i of theFiles) with write
permission
set t to read aFile
set t to REReplace t with "" pattern "^\\s+"
set t to REReplace t with "" pattern "-+\\r" separator "6"
set t to REReplace t with "\\t" pattern "\\r+" separator "6"
set eof of aFile to 0
write t to aFile
close access aFile
end repeat
set goFlag to true
on error errMsg number errNum
close access aFile
beep
display dialog errMsg & return & return & errNum
end try

if goFlag is true then
tell application "Finder"
move theFiles to destFldr with replacing
end tell
end if
-----------------------

> I'm working on a project in which I need to manipulate large text files, one
> line at a time. I've been looking for some sort of OSAX that can do this
> because I cannot afford the memory and time requirements to read in lots of
> big (2.5 MB) text files and then save them out, but have been unsuccessful.
>
> Essentially, I just want to read the first line of the file and delete it from
> the file and add another line to the bottom of the file.
>
> Anybody have any ideas?
>
> Thanks alot!



> I'm working on a project in which I need to manipulate large text files, one
> line at a time. I've been looking for some sort of OSAX that can do this
> because I cannot afford the memory and time requirements to read in lots of
> big (2.5 MB) text files and then save them out, but have been unsuccessful.
>
> Essentially, I just want to read the first line of the file and delete it from
> the file and add another line to the bottom of the file.
>
> Anybody have any ideas?
>
> Thanks alot!


References: 
 >Long text file manipulation... (From: bRaD Weston <email@hidden>)

  • Prev by Date: Getting Info on volumes
  • Next by Date: Re: Variable-bridges through scripts
  • Previous by thread: Long text file manipulation...
  • Next by thread: Re: Long text file manipulation...
  • Index(es):
    • Date
    • Thread