• 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: shell script and text manipulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shell script and text manipulation


  • Subject: Re: shell script and text manipulation
  • From: "Reese, Stevan" <email@hidden>
  • Date: Wed, 23 Feb 2005 11:25:38 -0800

I've had good success using sed/awk even with unicode. There are so many
ways to get things done. :)

This is a few snips from a script I wrote that puts some text into InDesign.
property sr : "<000A>" --soft return  or forced line break
property bu : "<2022>" --bullet

    set theStyle to paragraphs of (do shell script "sed -n '" & n & "," & n
& "p' " & IDinputPfile & " |awk -F\\t '{ print $1 }{ print $2 }{ print $3 }{
print $4 }{ print $5 }'")

    set E1 to item 5 of theStyle

set features to do shell script "echo " & quoted form of E1 & " | sed
s-';'-'" & sr & bu & "'-g"



On 2/23/05 10:05 AM, "has" <email@hidden> wrote:

> Christian Vinaa wrote:
>
>> the various input from this list regarding shell scripts made me wonder
>>
>> ok  shell scripts arae good for    CURL  and DATE  stuff
>>
>> but what about text manipulation ?
>
> There's traditional unix tools like awk and sed, but those are only
> good for working in ASCII. I'd recommend using Perl, Python or Tcl,
> which are all Unicode-savvy and include plenty of text processing
> tools as standard. Mind you'll probably need to munge text encodings
> a bit at input and/or output if calling via 'do shell script'. For
> Perl-based regular expressions, check out the RE library at AppleMods
> <http://applemods.sourceforge.net/>, though note that it's unfinished
> so can't yet handle large amounts of text. If you're doing a lot of
> text processing you might even consider switching completely; it's
> much less hassle than bouncing between languages via slow and clumsy
> 'do shell script' calls.
>
> has

Stevan

 _______________________________________________
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: shell script and text manipulation
      • From: has <email@hidden>
References: 
 >Re: shell script and text manipulation (From: has <email@hidden>)

  • Prev by Date: Re: shell script and text manipulation
  • Next by Date: Re: Aaaarrrggghhh XML!
  • Previous by thread: Re: shell script and text manipulation
  • Next by thread: Re: shell script and text manipulation
  • Index(es):
    • Date
    • Thread