Hi all,

Let me start by saying "Thank you" for the great job you are all doing
for the OpenBSD project and community.

I have tried sending this email to www@ but it bounced (reported in a
separate email) hence, for a lack of a better place, resending it here.

In the FAQ 2.4[0] there's an example of how to get the content of a
particular line from a file with the source code:

# cat -n pf.c | head -n 3872 | tail -n 1

While, in this instance, it does not fall under the "Useless use of
cat"[1] (as the '-n' option provides line numbering) the command
construct in unnecessarily long (three commands instead of one).

I can understand (I think) that the very reason of it being that
"complex" is the fact someone wanted for the line number to be included
in the output. This, however, is superfluous, as we explicitly "ask" for
the line in question while using 'head | tail' pipe, so the whole thing
can be shortened to:

# head -n 3872 pf.c | tail -n 1

IMVHO, since the FAQ section is mostly aimed at new, often
inexperienced, users it may be a good idea to start them off with a good
habit of using the simplest tool for the job, instead of overly complex
constructs.

One such way would be to use 'sed' instead:

# sed -n 3872p pf.c

I have included a small patch if you'd care to apply it to said page.

[0] http://www.openbsd.org/faq/faq2.html#Bugs
[1] http://partmaps.org/era/unix/award.html

Best regards,

Raf

[demime 1.01d removed an attachment of type text/x-diff]

Reply via email to