home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!psinntp!jpradley!jpr
- From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
- Subject: Re: searching a file
- Date: Sun, 03 Jan 1993 07:07:21 GMT
- Message-ID: <1993Jan03.070721.14178@jpradley.jpr.com>
- References: <1993Jan3.021839.10462@mnemosyne.cs.du.edu>
- Organization: Unix in NYC
- Lines: 17
-
- In article <1993Jan3.021839.10462@mnemosyne.cs.du.edu> sscrivan@nyx.cs.du.edu (steve scrivano) writes:
- >I want to search my /usr/dict/words and pull out lines by the occurrence
- >of certain letters in the words for example: all lines that contain
- >no more than "2 l's" or no more than 3 "r's" or no more than one "n", etc.
- >How would I accomplish this considering letters can fall in different
- >places within a word? A bin shell approach would be preferred.
- >
-
- Here's a command to print all words in /usr/dict/words having 1, 2 or 3 "l"s:
-
- </usr/dict/words tr '[A-Z]' '[a-z]' |
- sed -n '
- /^\([^l]*l[^l]*\)\1\{0,2\}$/p
- '
-
- --
- Jean-Pierre Radley Unix in NYC jpr@jpr.com jpradley!jpr CIS: 72160.1341
-