Re: piping sed to sed commands
Re: piping sed to sed commands
- Subject: Re: piping sed to sed commands
- From: Chris Janton <email@hidden>
- Date: Sat, 17 Jan 2004 10:44:13 -0700
On Jan 17, 2004, at 8:46 AM, email@hidden
wrote:
Is there a way in sed/regex to only print these lines dropping the
rest? If
not, I can use your above solution piping 7 commands together, but it
seems
like a kludge.
no reason to pipe 7 commands to get the results. sed can handle lots of
commands at once.
Let's try it this way
sed -n -e 's|1|1a|p' -e 's|2|2a|p' -e 's|3|3a|p' -e 's|4|4a|p' -e
's|5|5a|p' -e 's|6|6a|p' -e 's|7|7a|p' file
the "-n" says do not print lines to stdout by default
the "p" at then end of each substitute command says "print the current
line"
teatime 13 % sed -n -e 's|.*<key>Name</key><string>\(.*\)</string>|<td
class=Name>\1|p' -e 's|.*<key>Artist</key><string>\(.*\)</string>|<td
class=Artist>\1|p' plist
<td class=Name>Rock Me Right
<td class=Artist>Susan Tedeschi
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.