On 17/03/17 09:16 AM, Jan Beich wrote: > Vinson Lee <v...@freedesktop.org> writes: > >> echo " `$1`" | sed -E \ >> -e 's/[[[:space:]]]+-m[[^[:space:]]]*//g' \ >> - -e 's/[[[:space:]]]+-DNDEBUG\>//g' \ >> + -e 's/[[[:space:]]]+-DNDEBUG[[[:>:]]]//g' \ > > Try matching some whitespace after the word as a workaround e.g., > > -e 's/[[[:space:]]]+-DNDEBUG($|[[[:space:]]])/\1/g'
Instead of ($|...) I'd just add a space at the end of the string we feed to sed as well, i.e. echo " `$1` " | sed -E \ Other than that, I agree replacing \> with [[[:space:]]] is probably the best solution, since the former wouldn't work as intended anyway with hypothetical switches containing one we're matching for as a prefix, e.g. -DNDEBUG-THANKS / -D_GNU_SOURCE-PLEASE / -pedantic-aggressive / -fno-rtti-at-all / ... :) -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev