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
Delivered-to: email@hidden
Delivered-to: email@hidden
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:
http://lists.apple.com/mailman/options/applescript-users/lists%
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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.