Re: sed: backreference in substitution does not work as expected

From: Chris Mattern (syscjm_at_gwu.edu)
Date: 12/29/03


Date: Mon, 29 Dec 2003 13:44:59 -0500

Ronald Fischer wrote:
> Could some friendly soul tell me why
>
> ... | sed -e 's/a(.)b/\1/'
>
> causes the error message
>
> sed: Function s/a(.)b/\1/ cannot be parsed
>
Because you have no referent for "\1". In sed
REs, if you wish parentheses to be metacharacters,
you must escape them with backslashes. This will
work:

sed -e 's/a\(.\)b/\1/'

         Chris Mattern



Relevant Pages

  • Re: Error after code is run
    ... Set LookupRange = ... res = Application.VLookup(frm_InputTM.txt_PrtNumber.Value, ... Look at your Workbook Before_Close code in the ... | the end when i want to close it, i get an error message "Run-Time error ...
    (microsoft.public.excel.programming)
  • Re: what are dialog or database errors in creating a new list in mail.
    ... Please respond to the Newsgroup for the benefit of others who may be ... Doug Robbins - Word MVP ... "soul" wrote in message ... >I keep getting an error message that says "This operation cannot be ...
    (microsoft.public.word.mailmerge.fields)
  • Re: problems with login script
    ... $res = mysql_query; ... When the query fails, mysql_queryreturns false, which results in ... of mysql_queryand use mysql_errorto get the error message. ...
    (comp.lang.php)
  • Re: passing a struct with an array by reference
    ... As res is of type MatlabWrap.micDataReturn which is decalred as struct, it means that res is ValueType. ... Value types gets allocated on stack, and because of that they have to be initialized befor they are first used, because the compiler doesn't make any assumptions about the res initial value. ... Because your method takes a ref parameter, then the compiler expects that this value is already initialized by you, and because it isn't, then it generate that error message. ...
    (microsoft.public.dotnet.languages.csharp)