Find all words containing characters in UNIX

后端 未结 6 939
误落风尘
误落风尘 2021-02-14 15:18

Given a word W, I want to find all words containing the letters in W from /usr/dict/words. For example, \"bat\" should return \"bat\" and \"tab\" (but not \"table\").

He

6条回答
  •  失恋的感觉
    2021-02-14 15:41

    This utility might interest you:

    an -w "tab" -m 3
    

    ...gives bat and tab only.

    The original author seems to not be around any more, but you can find information at http://packages.qa.debian.org/a/an.html (even if you don't want to use it itself, the source might be worth a look).

提交回复
热议问题