This bash script is supposed to remove leading whitespace from grep results:
#!/bin/bash
grep --color=always $@ | sed -r -e's/:[[:space:]]*/:/'
But it doesn't match the whitespace. If I change the substitution text to "-", that shows up in the output, but it still never removes the whitespace. I've tried it without the "*", escaping the "*", with "+", etc, but nothing works. Does anyone know why not?
(I'm using sed version 4.2.1 on Ubuntu 12.04.)
Thanks all, this is my modified script, which shows grep color and also trims leading blanks:
#!/bin/bash
grep --color=always $@ | sed -r -e's/[[:space:]]+//'