From owner-freebsd-hackers Sun Jul 23 18:43:43 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.11/8.6.6) id SAA23076 for hackers-outgoing; Sun, 23 Jul 1995 18:43:43 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id SAA23070 for ; Sun, 23 Jul 1995 18:43:35 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id LAA29063; Mon, 24 Jul 1995 11:39:30 +1000 Date: Mon, 24 Jul 1995 11:39:30 +1000 From: Bruce Evans Message-Id: <199507240139.LAA29063@godzilla.zeta.org.au> To: jhs@vector.eikon.e-technik.tu-muenchen.de, w@cs.tu-berlin.de Subject: Re: your mail Cc: aturetta@stylo.italia.com, freebsd-hackers@FreeBSD.org, joerg_wunsch@uriah.heep.sax.de Sender: hackers-owner@FreeBSD.org Precedence: bulk >4.4BSD sed is broken. You must quote '/'in brackets, >eg. sed -e 's/.*[\/]//' 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: echo ']' | sed 's/[]]/:-(/' Quoting of ']' doesn't work: echo '\]' | sed 's/[\]]/:-(/ # range is '\', last ']' is literal Ranges (with a '-') ending with a ']' don't seem to be possible. This braindamage seems to be inherited from the original ed. Quotes work if and only if they are necessary, except for bugs when it wasn't obvious when they are necessary :-). This philosophy seems to be implemented in FreeBSD sed: echo '\;' | sed 's/[\;]/:-(/g' # quote in brackets not nec., so literal echo '\/' | sed 's/[\/]/:-(/g' # bug: quote not nec., but not literal Bruce