finding words that contain only 3 characters using sed in a file
0
votes
4
answers
4877
views
I need to print only words that consist of 3 characters, however the word document is a numbered list.
Here's the exact question that I have to answer:
> Using the
sed
command with [[:lower:]]
character class on the animals
file, find all the animal names that are only three characters long _(3 marks)_.
This is what i have tried:
cat animals | sed '/{[:lower:]].../d'
cat animals | sed '/{[:lower:]]/d'
sed '/[[:lower:]]{3}/d' animals
This is the file I am trying to find the words from (the animals
file):
01. aardvark
02. badger
03. cow
04. dog
05. elephant
06. fox
07. goose
08. horse
09. iguana
10. jackal
11. koala
12. lamb
13. mongoose
14. narwhal
15. onyx
16. pig
17. quail
18. rat
19. snake
20. tiger
21. umbrellabird
22. vulture
23. walrus
24. xerus
25. yak
26. zebra
i have just found out the code cannot have the [[:lower:]] in it more than once is there a way to do this??
Asked by ItCouldBeMe
(53 rep)
Oct 20, 2018, 07:57 PM
Last activity: Oct 24, 2018, 02:36 AM
Last activity: Oct 24, 2018, 02:36 AM