Re: text item delimiter
Re: text item delimiter
- Subject: Re: text item delimiter
- From: Rob Stott <email@hidden>
- Date: Fri, 29 Apr 2005 15:54:45 +0100
On 29 Apr 2005, at 15:25, Ruby Madraswala 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.........................
I wouldn't do it using TIDs. Here's how I'd do it ...
tell application "Finder" set theFile to quoted form of (POSIX path of (choose file)) end tell
set theResult to do shell script "cat " & theFile & " | sed 'y/abcdefghi/123456789/' | sed 's/j/10/g' | sed 's/k/11/g' | sed 's/l/12/g' | sed 's/m/13/g' | sed 's/n/14/g' | sed 's/o/15/g' | sed 's/p/16/g' | sed 's/q/17/g' | sed 's/r/18/g' | sed 's/s/19/g' | sed 's/t/20/g' | sed 's/u/21/g' | sed 's/v/22/g' | sed 's/w/23/g' | sed 's/x/24/g' | sed 's/y/25/g' | sed 's/z/26/g'"
...theres almost certainly a better way that doesn't involve that many 'sed's for multiple digits but I'm not sure how. Can anyone put me straight on that one?
r.
|
_______________________________________________
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