bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38792: man grep


From: Martin Simons
Subject: bug#38792: man grep
Date: Sun, 29 Dec 2019 15:24:47 +0100
User-agent: Roundcube Webmail/1.1.5

Dear Friend,

At the moment I am working part time as a Unix / Linux teacher and also as an AIX system administrator. Privately I am using Debian / Ubuntu and I use it while in class, giving presentations and on the fly examples of statements and so on.

In class I tell the students how grep should be used in a directory called test. Please find the contents of the directory and some files below. My example of use is as follows:
martin@laptop:~/test$ grep 'Jantje*' school.txt
Which delivers the desired output:
Jantje
Ik las dat Jantje
Jantje voortaan op tijd op school komt,
Hoogachtend, Jantjes vader, Piet Bel.

So far for the class. In reality, however, in most occasions the statement will be issued like this (objections are being laughed away):
martin@laptop:~/test$ grep Jantje* school.txt
Delivering this undesired output:
Jantjes:Jantje zag eens pruimen hangen
Jantjes:en Jantje wilde pruimen plukken voor zijn moeder
Jantjes:toen zei Jantjes moeder
Jantjes:pas toch op Jantje!
school.txt:Jantje
school.txt:Ik las dat Jantje
school.txt:Jantje voortaan op tijd op school komt,
school.txt:Hoogachtend, Jantjes vader, Piet Bel.

In trying to give more weight to the argument I pointed the students to the man page of grep, but it struck me that there is not a single reference to the need of using quotes in the search pattern. This does not help.

I checked the AIX man page for grep and they at least give some, not all, examples of using quotes around the search pattern.

The example given above makes me assume grave errors occur in production environments, just because users are not lead to use search patterns right.

It may no be the task of the grep project to provide a man page, but even then I feel there is an opportunity for improvement here by providing a basic man page with a couple of good examples. I would be more than glad to contribute.

Files and Contents of test.
Diectory test:
-rw-r--r-- 1 martin martin 208 May 20  2019 Jantje
-rw-r--r-- 1 martin martin 124 Apr 30  2019 Jantjes
-rw-r--r-- 1 martin martin 242 Jun 27  2019 school.txt

The contents of Jantjes and school.txt are:
file Jantjes:
Jantje zag eens pruimen hangen
en Jantje wilde pruimen plukken voor zijn moeder
toen zei Jantjes moeder
pas toch op Jantje!

file school.txt:
Geachte Heer de Vries,

Jantje

Ik las dat Jantje
weer eens te laat op school kwam.

Ik kan u verzekeren dat wij er alles aan
zullen doen om er voor te zorgen dat
Jantje voortaan op tijd op school komt,

Hoogachtend, Jantjes vader, Piet Bel.

Met vriendelijke groet,
Martin.

LinkedIn: https://www.linkedin.com/in/martinsimons1/
GitHub:   https://github.com/Webhuis/CFEngine-Roadshow/tree/master/
Twitter:  https://twitter.com/webhuis @Webhuis #TheCFEngineRoadshow






reply via email to

[Prev in Thread] Current Thread [Next in Thread]