Re: Problem with positional output

"Cameron Simpson [email protected] [sed-users]" <[email protected]> Wed, 16 Nov 2016 09:33:30 +1100
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 14Nov2016 14:09, Michelle Konzack <[email protected]> wrote:
>> The string has 4 parameters, deperated by the | sign and I like  to  get
>> it with something like
>>
>>      echo "${RETVAL}" |sed 's!(.*)|(.*)|(.*)!$1!'
>
>This is now working with:
>
>   echo "${RETVAL}" |sed 's!\(.*\)|\(.*\)|\(.*\)!\1!'

By default sed uses Basic Regular Expressions, where \( and \) and needed for 
grouping. Some seds (eg GNU sed) accept a -E option to enable Extended Regular 
Expressions, where ( and ) are the syntax (and various other extra things 
work).

Cheers,
Cameron Simpson <[email protected]>