From: xyfix on
guys,

I need some help on a sed script that works on linux RH 3 but not on a
SUN OS 5.8.

I tried to translate this working linux sed line

s/^\(.*\.\s\)\{0,1\}.*s\s\([0-9]*\.\{0,1\}[0-9]*\)\(.*\)$/\2 \1/

to

s/^\(.*\.[ \t]\).*s[ \t]\([0-9]*\.[0-9]*\)\(.*\)$/\2 \1/

but the zero or one time occurrence \{0,1\} does not work. I even
tried the ? character. Can Somebody help me out please?
From: Oscar del Rio on
xyfix wrote:
> I tried to translate this working linux sed line
>
> s/^\(.*\.\s\)\{0,1\}.*s\s\([0-9]*\.\{0,1\}[0-9]*\)\(.*\)$/\2 \1/
>
> to
>
> s/^\(.*\.[ \t]\).*s[ \t]\([0-9]*\.[0-9]*\)\(.*\)$/\2 \1/

if you give an example of input and expected output someone might be
willing to help you without having to disassemble your code.

Or install GNU sed, I guess that's what linux uses.
From: usenetpersongerryt on
On Apr 22, 4:59 am, xyfix <xy...(a)hotmail.com> wrote:
> guys,
> I need some help on a sed script that works on linux RH 3 but not on a
> SUN OS 5.8.
> I tried to translate this working linux sed line
> s/^\(.*\.\s\)\{0,1\}.*s\s\([0-9]*\.\{0,1\}[0-9]*\)\(.*\)$/\2 \1/
> to
> s/^\(.*\.[ \t]\).*s[ \t]\([0-9]*\.[0-9]*\)\(.*\)$/\2 \1/
> but the zero or one time occurrence \{0,1\} does not work. I even
> tried the ? character. Can Somebody help me out please?

Try using POSIX sed in /usr/xpg4/bin. man xpg4
From: xyfix on

Thanks alot guys,

I found a solution, just use gnu sed on the solaris and not the one
that comes along with it. The line below works perfectly for me.

s/^\(.*\.[ \t]\)\?.*s[ \t]\([0-9]*\.\?[0-9]*\).*$/\2 \1/
From: Andreas F. Borchert on
On 2008-04-22, xyfix <xyfix(a)hotmail.com> wrote:
> I need some help on a sed script that works on linux RH 3 but not on a
> SUN OS 5.8.
>
> I tried to translate this working linux sed line
>
> s/^\(.*\.\s\)\{0,1\}.*s\s\([0-9]*\.\{0,1\}[0-9]*\)\(.*\)$/\2 \1/

Use /usr/perl5/bin/s2p to convert your sed line into a Perl script.
On newer Solaris releases, you will also find psed, a Perl-based
replacement of sed.

/usr/bin/sed under Solaris is derived from the original utility
which was developed by Lee E. McMahon in 1973/1974. GNU sed was
developed at the end of the 80s or at the beginning of the 90s
with additional features. A POSIX-compatible version is to be
found in /usr/xpg4/bin/sed.

Andreas.