On Solaris, in the default environment, you get antiquated utilities.
To get more modern utilities, you need to update $PATH
:
PATH=`getconf PATH`:$PATH export PATH
That will get you utilities from the 90s as opposed to from the 80s (that's hardly an exaggeration...).
Then your grep
will behave more like a standard grep
.
Alternatively, you could use egrep
instead of grep -E
.
But here, awk
being a superset of egrep
, you don't need egrep
at all.
< "$EBM_CONF" awk -F, '! /^#|^EBM_SERVER|^$/ {print $2"|"}' |
tr -d "\n" |
sed 's/|$//g'
To join lines with |
, you'd better use paste
. Your last two commands can be replaced with paste -s -d '|' -
. Or you could do the whole thing in awk
:
< "$EBM_CONF" awk -F, '! /^#|^EBM_SERVER|^$/ {printf "%s", sep $2; sep = "|"}'