Web design course - $ tr ‘!?”:;[]{}(),.tn’ ‘ ‘ < /home/ranga/docs/ch15.doc |
$ tr ‘!?”:;[]{}(),.tn’ ‘ ‘ < /home/ranga/docs/ch15.doc | tr 'A-Z' 'a-z' | tr -s ' ' | tr ' ' 'n' | sort The uniq Command At this point, you can eliminate all the repeated words by using the -u ( u as in unique) option of the sort command. Because you need a count of the number of times a word is repeated, you should use the uniq command. By default, the uniq command discards all but one of the repeated lines. For example, the commands $ echo ' peach peach peach apple apple orange ' > ./fruits.txt $ uniq fruits.txt produce the output peach apple orange As you can see, uniq discarded all but one of the repeated lines. The uniq command produces a list of the uniq items in a file by comparing consecutive lines. To function properly, its input needs to be a sorted file. For example, if you change fruits.txt as follows $ echo ‘ peach peach orange apple apple peach ‘ > ./fruits.txt $ uniq fruits.txt the output is incorrect for your purposes: peach orange apple peach Returning to the original problem, you need uniq to print not only a list of the unique words in this chapter
We recommend high quality webhost to host and run your jsp application: christian web host services.