www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/30/21:31:18

From: "Douglas G. Fowley" <fowley-dg AT salem DOT ge DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: SED problem
Date: Tue, 30 Sep 1997 15:56:10 -0400
Organization: GE Industrial Systems
Lines: 25
Message-ID: <3431595A.5610@salem.ge.com>
NNTP-Posting-Host: fowley.salem.ge.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

SED apparently ignores escape sequences in its regular expressions.
For example:

    C:\temp>echo this is a TAB \    \ >test

NOTE:  there is a single TAB character between the backslashes.

    C:\temp>sed -e "s/\t/<TAB>/" test
    <TAB>his is a TAB "     "

    C:\temp>sed --version
    GNU sed version 1.18

Is this a bug or am I doing something stupid?

To answer my own question, I hacked into the source.  In sed.c,
function compile_regex(), on line 1045, the code to recognize
'\b', '\f', '\t', and '\r' has been turned off.  When I turn
the code back on, re-make, and run the test again, I get:

    C:\temp>sed -e "s/\t/<TAB>/" test
    this is a TAB \<TAB>\ 

which is what I expect.  Anyone know why the SED code fragment
is turned off?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019