• 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: do shell script- sed conundrum
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script- sed conundrum


  • Subject: Re: do shell script- sed conundrum
  • From: Le Stang Jean-Baptiste <email@hidden>
  • Date: Sat, 18 Feb 2006 10:23:28 +0100

I think you can do it very easily with with the Satimage osax and a tiny regexp :

set theText to "Title: King KongTitle: Godzilla
Title: Mothra"
change "([^\\r\\n])Title: " into "\\1\\rTitle: " in theText with regexp

Jean-Baptiste LE STANG


Le 18 févr. 06 à 05:47, Jonathan Levi MD a écrit :

On Fri, 17 Feb 2006 13:47:58 -0700, Gnarlodious <email@hidden> wrote:
Entity Eric Geoffroy spoke thus:

> Starting text
Title: King KongTitle: Godzilla
 > Title: Mothra

[...]
In general, sed is a linewise command and not well suited to multilines,
although there are ways around that limitation.


I think you can do it cleanly and compactly with sed, if you allow yourself tr:

tr '\r' '\n' < yourfile			|\
sed 's/\(.\)\(Title:\)/\1\n\2/g'	|\
tr '\n' '\r'

HTH,

Jonathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (Applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
40lestang.org


This email sent to email@hidden


_______________________________________________ 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
References: 
 >do shell script- sed conundrum (From: Jonathan Levi MD <email@hidden>)

  • Prev by Date: Re: Toggle Screensaver
  • Next by Date: hello from a new memeber
  • Previous by thread: do shell script- sed conundrum
  • Next by thread: hello from a new memeber
  • Index(es):
    • Date
    • Thread