Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run the following sed syntax on Solaris machine and on Linux machine

on Linux machine sed do the JOB its remove all characters until the first number.

but why this sed syntax not work on Solaris ?

What I need to change in the sed syntax in order run it on Solaris?

on solaris (sed - not remove the strings until the first number?)

   solaris:/ ROOT > echo "Release............"  | sed 's/[^0-9]\+//'


on linux ( I get good results )

  linux tmp]# echo "Linux Release............"  | sed 's/[^0-9]\+//'
share|improve this question
Take a look at, you can download the GNU version of utilities from there as packages. – Iain Jan 10 '12 at 16:58
possible duplicate of How do I use sed or awk to remove text? – MadHatter Jan 10 '12 at 17:04
up vote 4 down vote accepted

Solaris generally doesn't have the GNU version of anything by default. This means that the options and arguments you supply will often have to be different to get the same behaviour out of utilities like sed.

Sometimes it will not be possible to get the same behaviour at all, for instance, sed -i won't work on Solaris unless you have installed the GNU version of sed.

From memory, the sed on Solaris supports the "basic" set of regular expressions and this doesn't include the + modifier. You can simulate a + like this:

sed 's/[^0-9][^0-9]*//'

Or you can just use a * for this case:

sed 's/[^0-9]*//'

Solaris usually also has the BSD versions of these utilities installed under /usr/ucb. they are often very similar but occasionally have important differences, such as with ps.

share|improve this answer
Things like this are why I hate Solaris with a passion. – Al-Muhandis May 8 '15 at 17:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.