From owner-freebsd-hackers Mon Jul 24 03:23:32 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id DAA14336 for hackers-outgoing; Mon, 24 Jul 1995 03:23:32 -0700 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.cdrom.com (8.6.11/8.6.6) with SMTP id DAA14320 for ; Mon, 24 Jul 1995 03:23:19 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA26212; Mon, 24 Jul 1995 12:23:07 +0200 Received: by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id MAA18789 for freebsd-hackers@freebsd.org; Mon, 24 Jul 1995 12:40:16 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.6.11/8.6.9) id IAA04053 for freebsd-hackers@freebsd.org; Mon, 24 Jul 1995 08:12:46 +0200 From: J Wunsch Message-Id: <199507240612.IAA04053@uriah.heep.sax.de> Subject: Re: your mail To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Mon, 24 Jul 1995 08:12:45 +0200 (MET DST) Reply-To: freebsd-hackers@freebsd.org (FreeBSD hackers) In-Reply-To: <199507240139.LAA29063@godzilla.zeta.org.au> from "Bruce Evans" at Jul 24, 95 11:39:30 am Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 1675 Sender: hackers-owner@freebsd.org Precedence: bulk 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. ;-)