• 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: piped "sed" not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: piped "sed" not working


  • Subject: re: piped "sed" not working
  • From: Chris Janton <email@hidden>
  • Date: Sat, 17 Jan 2004 05:18:07 -0700

do shell script "sed -e
's/.*<key>Name<\\/key><string>\\(.*\\)<\\/string>/<td class=Name>\\/' | sed
's/.*<key>Artist<\\/key><string>\\(.*\\)<\\/string>/<td class=Artist>\\/' "
& inPOSIX & ">" & outPOSIX


for one, shouldn't there be a "-e" for the second sed command?

for two - why not use a different character for your substitute command like

s|foo|bar|

instead of

s/foo/bar/

that way you don't get quite so many confusing escaped escape slashes

Oh, yeah, couldn't you use this construct

sed -e 's|a|b|' -e 's|X|Y|' file

this is what I get on the command line...

teatime 10 % sed -e 's|.*<key>Name</key><string>\(.*\)</string>|<td class=Name>\1|' -e 's|.*<key>Artist</key><string>\(.*\)</string>|<td class=Artist>\1|' plist
<key>Track ID</key><integer>456</integer>
<td class=Name>Rock Me Right
<td class=Artist>Susan Tedeschi
<key>Album</key><string>Just Won't Burn</string>
<key>Genre</key><string>Rock Blues</string>
<key>Kind</key><string>AAC audio file</string>

8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Piping sed to sed commands
  • Next by Date: Re: Looking for script that replaces last chars and replace it by .jpg
  • Previous by thread: Re: Confusion says what? (was Re: Script expects quoted text mystery)
  • Next by thread: Re: Piping sed to sed commands
  • Index(es):
    • Date
    • Thread