[olug] need some quick help with sed

Kevin D. Snodgrass kdsnodgrass at yahoo.com
Sat Dec 19 07:33:58 UTC 2009


--- On Fri, 12/18/09, DYNATRON tech <dynatron at gmail.com> wrote:

> From: DYNATRON tech <dynatron at gmail.com>
> Subject: Re: [olug] need some quick help with sed
> To: olug4mgm at paktronix.com, "Omaha Linux User Group" <olug at olug.org>
> Date: Friday, December 18, 2009, 4:59 PM
> and the winner is....
> 
> 
>      
>    bloatedpostID="$(echo -e`cat
> ../xml/slauce.xml | grep postID`)"
>          postID="$(echo `echo
> $bloatedpostID | *sed -e 's/<[^>]*>//g'`)"*

[friggin' yahoo mail and it's word wrap]

Why break it into two parts?  Command line pipes were created for a reason...

And why do a "cat", piped into grep?  grep works just fine reading from a file...

> 
> obi-wan...much thanks.
>  let me know if you have some time for sed lessons.

Yep, his sed syntax is much better than what I submitted.  Both work, so you have choices.

O'Reilly has your lessons right here:
http://oreilly.com/catalog/9781565922259
http://oreilly.com/catalog/9781565927292

> my comments on sed documentation were best summed up by
> bruce barnett who
> said this in his grep tutorial <http://www.grymoire.com/Unix/Sed.html>..

There are a couple of books, ENTIRE BOOKS, devoted to sed and awk.  Major power to the sysadmins that know sed and awk.  (Some where, long ago, in a far away place, I had a book on sed and awk.  Not on the bookshelf anymore. Someone needed it more that me.)

Kevin D. Snodgrass



      



More information about the OLUG mailing list