Date: Mon, 24 Jul 1995 08:12:45 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> To: freebsd-hackers@freebsd.org (FreeBSD hackers) Subject: Re: your mail Message-ID: <199507240612.IAA04053@uriah.heep.sax.de> In-Reply-To: <199507240139.LAA29063@godzilla.zeta.org.au> from "Bruce Evans" at Jul 24, 95 11:39:30 am
next in thread | previous in thread | raw e-mail | index | archive | help
As Bruce Evans wrote: > > >4.4BSD sed is broken. You must quote '/'in brackets, > >eg. sed -e 's/.*[\/]//' ...which would have been equivalent to sed -e 's/.*\///' Anyway, FreeBSD 1.1.5.1's sed has been broken for this and didn't recognize the escaped second slash. I'm not sure if 4.4BSD's sed is *broken*. I've studied Posix 1003.2 up and down, and it has been not clear if the regexp delimiters should have higher or lower precedence than brackets. I think the behaviour of this sed is strange, but not violating Posix (unlike the Net-2 sed, escaping the regexp delimiter is required to work). > Is this portable? I thought that '\' isn't special in brackets. It isn't > needed even to quote ']' - you can put the ']' first so that it isn't > interpreted as the end of the brackets: I'm not sure. I've replaced the Internet Info CD in my drive with the newly-arrived 2.0.5 `live filesystem' as a replacement for my missing /usr/src yesterday, so i cannot look into 1003.2 right now. I think backslashes are special, and you're supposed to escape at least backslashes themselves. I think this one should also apply for [] groups, explaining the need for backslashes under some circumstances: 2. The escape sequence \n matches a newline character embedded in the pattern space. You can't, however, use a literal newline character in an address or in the substitute command. You are right, ranges including a `]' are impossible, as well as ranges including a hyphen. See re_format(7). -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507240612.IAA04053>