9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Geoff Collyer <geoff@collyer.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] text utility
Date: Tue, 22 Jul 2003 16:28:05 -0700	[thread overview]
Message-ID: <5d6d2e6816f4cad3c83e828f8683e9ab@collyer.net> (raw)
In-Reply-To: <8094c5486230a87031c84cbcb873866c@vitanuova.com>

I'm pretty sure it was Doug McIlroy who used

	rev <dict | sort >rhymdict

to produce a rhyming dictionary.  To find rhyming words, you'd reverse
the suffix of a word, look that up and reverse the result:

	look `{echo suffix | rev} rhymdict | rev

This is described in a memo called `Webster's 2nd on the head of a
pin' and dates from the mid-1970s.  (I have a copy somewhere.)

As for tac,

	tail -1000000000r

does the job for most files of interest (those under a billion lines).
I just tried it on a file of ~250,000 lines; it's quite quick.
Alternatively,

	awk '{print NR, $0}' | sort -nr | sed 's/^[0-9]+ //'

does the job more slowly.



  parent reply	other threads:[~2003-07-22 23:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-21 11:45 pac
2003-07-21 11:52 ` boyd, rounin
2003-07-22 14:09   ` rog
2003-07-22 14:35     ` boyd, rounin
2003-07-22 16:43       ` rog
2003-07-22 23:28     ` Geoff Collyer [this message]
2003-07-23 15:05       ` rog
2003-07-23 18:42         ` Dan Cross
2003-07-24  9:19           ` matt
2003-07-28  8:47       ` Ralph Corderoy
2003-07-28 21:58         ` Geoff Collyer
2003-07-30  8:25           ` Ralph Corderoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d6d2e6816f4cad3c83e828f8683e9ab@collyer.net \
    --to=geoff@collyer.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).