I want to find a
x, and replace the 0 or more following spaces (
\s*) with just a single space.
echo "x ax" | sed 's/x\s*/x /'
For some reason, instead of replacing the spaces with the single space, it just appends one space to however many existed there before:
The use of
+ instead of
* appears to absolutely nothing, regardless of my use of the
It appears that
sed doesn't do non-greedy expressions, so why doesn't this
* consume all of the spaces when matching?
I'm a regex ninja in non-bash settings, but bash and its tools eat me alive. I've got no idea how to concisely phrase this for a successful search engine query.