Date: Thu, 7 Dec 2017 01:08:01 +0000 From: Ken Moffat <zarniwhoop@ntlworld.com> To: RW <rwmaillists@googlemail.com> Cc: freebsd-questions@freebsd.org Subject: Re: grep problem Message-ID: <20171207010801.GA10604@milliways.localdomain> In-Reply-To: <20171207005542.43a7f55f@gumby.homeunix.com> References: <20171207005542.43a7f55f@gumby.homeunix.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 07, 2017 at 12:55:42AM +0000, RW via freebsd-questions wrote: > > Can anyone explain why '-' needs escaping in the following. What > special meaning does it have outside of []? > > $ echo 'a-b' | grep 'a-b' > a-b > > $ echo 'a-b' | grep '-b' > Usage: grep [OPTION]... PATTERN [FILE]... > Try `grep --help' for more information. > > $ echo 'a-b' | grep '\-b' > a-b > In gnu grep, '-' indicates it should read from STDIN, I assume that FreeBSD's grep is the same. ĸen -- Truth, in front of her huge walk-in wardrobe, selected black leather boots with stiletto heels for such a barefaced truth. - Unseen Academicals
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171207010801.GA10604>