Sed programming question

Dan Thurman dant at cdkkt.com
Thu Dec 11 16:43:08 UTC 2008


Cameron Simpson wrote:
> On 10Dec2008 18:39, Dan Thurman <dant at cdkkt.com> wrote:
>   
> [snip!]
> You can only do AND by nesting multiple pattern matches:
>
>   /foo/{
>     /bar/{
>       ... do stuff for "foo" AND "bar"
>     }
>   }
>   
I tested your suggestion above with and without -r option
 but could not make it work as an "AND operator":

# echo "foo har" | sed -re '/foo/{/bar/{s/foo/goo/}}'
goo har





More information about the fedora-list mailing list