• 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: text item delimiter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: text item delimiter
      • From: kai <email@hidden>
    • Re: text item delimiter
      • From: Gnarlodious Lists <email@hidden>
    • Re: text item delimiter
      • From: Gnarlodious <email@hidden>
    • Re: text item delimiter
      • From: Martin Orpen <email@hidden>
    • Re: text item delimiter
      • From: Dave Balderstone <email@hidden>
    • Re: text item delimiter
      • From: "Mark J. Reed" <email@hidden>
References: 
 >text item delimiter (From: "Ruby Madraswala" <email@hidden>)

  • Prev by Date: Re: text item delimiter
  • Next by Date: Re: Exiting from an Applescript
  • Previous by thread: Re: text item delimiter
  • Next by thread: Re: text item delimiter
  • Index(es):
    • Date
    • Thread