Non greedy pattern match in sed

Michael Still mikal at stillhq.com
Tue Aug 13 16:25:55 EST 2002


Hey,

I would like non greedy regexp matching in sed.

i.e.

echo "/* This is a */ test /* line */" | sed 's/\/\*.*\*\//g'
                                                            ^^
                                                    Non greedy toggle
                                                    here?

Should result in:

" test "

Any hints?

Thanks,
Mikal

-- 

Michael Still (mikal at stillhq.com)     UMT+10hrs




More information about the linux mailing list