Scripting / one liner help

Johnny Rosenberg gurus.knugum at
Thu Aug 11 08:35:06 UTC 2011

2011/8/10 Hal Burgiss <hal at>:
> On Wed, Aug 10, 2011 at 3:00 PM, Johnny Rosenberg <gurus.knugum at>
> wrote:
>> 2011/8/10 Hal Burgiss <hal at>:
>> >
>> > See if this gets close to extracting the image names ...
>> > grep SRC *html | sed -r 's/SRC="([^"]+)"/\1/ig' |
>> I didn't create this thread, but can you please explain that sed
>> statement? I don't get it… (I'm not a beginner with regular
>> expressions but I'm definitely not an expert either…)
> Its attempting to capture the string in between:
>  SRC="  and the next doublequote: ".  The [^"] stops the capture at the next
> double quote. The capture should then include any character that is NOT a
> double quote. If not careful, the expression could get "greedy" and start
> matching other double quotes on the same line.  This should stop that
> effect. The \1 is a reference back to the capture that is in the
> parenthesis, in sed syntax, which essentially just preserves the captured
> characters, and ignores the rest. Does that make sense?

Aaaah…! Thanks! I always forget that ^ means NOT in some situations,
that happened to me before (I should learn some time, shouldn't I?)…!
I just didn't get it when I thought of ^ in its other meaning…

Best regards

Johnny Rosenberg

> --
> Hal
> --
> ubuntu-users mailing list
> ubuntu-users at
> Modify settings or unsubscribe at:

More information about the ubuntu-users mailing list