Thanks all.
I used the
script example given below and it worked.
I did get
quite a few suggestions to use “sed”, that’s so new for me. I did not find any reference
to this command in Applescript The Definitive Guide book. Is this new or you
just know by experience?
Thanks
again.
Ruby
-----Original
Message-----
From: Mark J. Reed [mailto:email@hidden]
Sent: Friday, April 29, 2005 11:01
AM
To: Ruby Madraswala
Cc: Applescript Users
Subject: Re: text item delimiter
That won't work; even if the
multiple-delimiter thing worked and the file text were split up properly, you
don't have any way of knowing which text items had a 1 between them, which had
a 2, etc; you'd probably end up with nothing but 'a's for delimiters in the new
file.
You have to do it one at a time:
set fileText to (read file ":path:to:some:file.txt")
set fromList to {"1", "2", "3", "4"}
set toList to {"a", "b", "c", "d"}
set oldDelims to AppleScript's text item delimiters
repeat with i from 1 to count fromList
set AppleScript's text item delimiters to fromList's item i
set wordList to text items of fileText
set AppleScript's text item delimiters to toList's item i
set fileText to wordList as text
end repeat
set AppleScript's text item delimiters to oldDelims
On 4/29/05, Ruby Madraswala
<email@hidden>
wrote:
Is this doable using text item delimiters, I tried it's not working. All I want
to do is search a text file replace all occurrence of 1 to a, 2 to
b.........................
Set FileText to read file tmptw from 1
Set Applescript's text item delimiters to
{"1","2","3","4"}
Set wordlist to text items of FileText
Set Applescript's text item delimiters to
{"a","b","c","d"}
Set FileText to wordlist as text
Ruby
_______________________________________________
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
--
Mark J. Reed < email@hidden>