• 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: Find and replace space by the Terminal equivalent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find and replace space by the Terminal equivalent


  • Subject: Re: Find and replace space by the Terminal equivalent
  • From: Barry Wainwright <email@hidden>
  • Date: Sun, 02 Oct 2005 04:02:58 -0700
  • Thread-topic: Find and replace space by the Terminal equivalent

Title: Re: Find and replace space by the Terminal equivalent
On 2/10/05 02:47, "Jay Louvion" <email@hidden> wrote:


How would you do a find and replace in a string where you want to replace spaces (“ “) by the command line equivalent (regarding file system, at least : “\ ”) for some obvious reason, it doesn’t compile, but what’s the workaround ?

If you are trying to pass a text string to the shell command line, you can just use ‘quoted form of ...’:

    quoted form of "this is a 'test' string"
        -- "'this is a '\\''test'\\'' string'"

This will allow you to send commands such as:   
    set myString to “Hello World!”
    do shell script “echo “& quoted form of myString

However, if this is not what you want, then the quickest way to accomplish your actual request is to use the TIDs:

Set myString to “Hello World!”
Set {oldTIDs, applescript’s text item delimiters} to { applescript’s text item delimiters, {“ “}}
Set myString to text items of myString
Set Applescript’s text item delimiters to {“\ “}
Set myString to Mystring as text
Set applescript’s text item delimiters to oldTIDs


--
Barry

 _______________________________________________
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: Find and replace space by the Terminal equivalent
      • From: Jay Louvion <email@hidden>
References: 
 >Find and replace space by the Terminal equivalent (From: Jay Louvion <email@hidden>)

  • Prev by Date: Find and replace space by the Terminal equivalent
  • Next by Date: Re: Can't get name of Window 1 in Excel
  • Previous by thread: Find and replace space by the Terminal equivalent
  • Next by thread: Re: Find and replace space by the Terminal equivalent
  • Index(es):
    • Date
    • Thread