From owner-freebsd-questions@FreeBSD.ORG Mon Jul 7 07:43:00 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00A7A80E for ; Mon, 7 Jul 2014 07:42:59 +0000 (UTC) Received: from blue.qeng-ho.org (blue.qeng-ho.org [217.155.128.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73B1B2490 for ; Mon, 7 Jul 2014 07:42:58 +0000 (UTC) Received: from fileserver.home.qeng-ho.org (localhost [127.0.0.1]) by fileserver.home.qeng-ho.org (8.14.7/8.14.5) with ESMTP id s677gl7B003582; Mon, 7 Jul 2014 08:42:48 +0100 (BST) (envelope-from freebsd@qeng-ho.org) Message-ID: <53BA4F77.60907@qeng-ho.org> Date: Mon, 07 Jul 2014 08:42:47 +0100 From: Arthur Chance User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Polytropon , FreeBSD Questions Subject: Re: The name "grep" References: <20140707075443.d47ca06a.freebsd@edvax.de> In-Reply-To: <20140707075443.d47ca06a.freebsd@edvax.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2014 07:43:00 -0000 On 07/07/2014 06:54, Polytropon wrote: > Sometimes I get a "nostalgic seizure", and when I do so, I read > one of my older books (which I have plenty of to choose from). > Yesterday's choice was "Keine Angst for UNIX" (no fear of UNIX) > by Christine Wolfinger, published 1991 by VDI Verlag Duesseldorf. > On page 173 I read something that I hadn't noticed yet (translated): > > grep: > global regular expression print > (combination of an editor command) > > So today I checked "man grep", but it doesn't mention it. Therefore > here are my questions, primarily aiming at "UNIX dinosaurs" and > historians on list - because you probably need to be either old > or interested in UNIX history in order to provide a substantial > opinion. :-) > > 1. Is the mentioned interpretation correct or at least acceptable? > > 2. Should the manpage mention it? > > In my opinion, "print lines matching a pattern" describes what > grep does, but not really what it means (or where the name of > the command comes from). Other manpages explain the name of the > command or provide background information so you can understand > why the particular name has been chosen, for example: > > sed = (s)tream (e)ditor (section NAME) > tar = manipulate (t)ape (ar)chives (section NAME) > awk = (A)ho, (W)einberger, (K)ernighan (section SEE ALSO) > dd = copy and convert (cc was taken by C compiler, but > not mentioned in the manpage; "common knowledge") > vi = visual editor (in contrast to ex; not mentioned) > > Should "man grep" contain a hint about "global regular expression > print" or something similar? > > From ancient memory circa 1980, probably suffering from bit rot: Before grep existed, to use ed to print lines in a file that match a particular regular expression ed $file g/re/p q where the "re" stands for the regular expression and you're applying the "p" (print) command to each line that matches it. When a newbie asked how to print matching lines in a file, you'd answer "grep" and show them the trick, and eventually the name got given to the grep program when it was written. I think the "global regular expression print" explanation is based on explaining what the original ed command did.