What konsolebox said.
In addition, you usually don't need sed
for this kind of thing, when you have lots of powerful string manipulation
features already built into the shell.
To remove all whitespace at the start of the variable string, for example:
shopt -s extglob
And when using the shell's built-in regex ability, store the expression in a variable first (using hard quotes), then use that inside the [[..]] brackets, unquoted. This will make it easier to compose them without having to fiddle with all the backslashes.
if [[ $line =~ $re ]]; then
And please use ***[code][/code]
*** tags around your code and data
, to preserve the original formatting and to improve readability. Do not
use quote tags, bolding, colors, "start/end" lines, or other creative techniques.