Skip to content

Commit 00da20c

Browse files
committed
doc: add more shell examples to the readme
1 parent c9f1cc6 commit 00da20c

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

readme.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,45 @@ There's a CLI that prints all words to STDOUT. Install it globally:
2525

2626
```sh
2727
npm i -g an-array-of-english-words
28+
```
29+
30+
Run `words` to print all the words to stdout:
31+
32+
```sh
33+
words
34+
```
35+
36+
Use `grep` to filter by pattern:
37+
38+
```
2839
words | grep cheese
2940
```
3041

42+
Use `egrep` to filter with regular expressions:
43+
44+
```sh
45+
words | egrep '^fun' # start with 'fun'
46+
words | egrep 'ification$' # end with 'ification'
47+
words | egrep 'ou?r$' # end in 'or' or 'our'
48+
```
49+
50+
Use `wc` to find out how many `monkey` words there are:
51+
52+
```sh
53+
words | grep monkey | wc -l
54+
```
55+
56+
Ten random ten-letter words:
57+
58+
```sh
59+
$ words | egrep '^.{10}$' | gshuf | head -10
60+
```
61+
62+
Note: On macOS, `brew install coreutils` to get
63+
[`gshuf`](https://en.wikipedia.org/wiki/Shuf) and other goodies.
64+
3165
## See Also
3266

33-
- [similar-english-words](http://ghub.io/similar-english-words)
34-
- [an-array-of-spanish-words](https://github.com/zeke/an-array-of-spanish-words)
35-
- [an-array-of-french-words](https://github.com/zeke/an-array-of-french-words)
67+
- [similar-english-words](https://github.com/words/similar-english-words)
68+
- [an-array-of-spanish-words](https://github.com/words/an-array-of-spanish-words)
69+
- [an-array-of-french-words](https://github.com/words/an-array-of-french-words)

0 commit comments

Comments
 (0)