write a shell script that counts a number of unique word
contained in the file and print them in alphabetical order
line by line?
Answer Posted / trenton g. twining
rm /tmp/$$; \
cat <file> \
| awk '{ for(i=1;i<=NF;i++){ printf("%s\n",$i); }; }' \
| sort -du \
| tee /tmp/$$; \
wc -w /tmp/$$ \
| sed -e "s=/tmp/$$=unique words="
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Is shell scripting easy to learn?
What is a boot block?
What is a shell made of?
How do I open a jshell in cmd?
Suppose you execute a command using exec, what will be the status of your current process in the shell?
What is console line?
How will you emulate wc –l using awk?
How to print pid of the current shell?
How do you debug a script?
What shell is bin sh?
Which shell is the best?
What is the difference between bash and shell?
how to get part of string variable with echo command only?
How do I run a powershell script?
Is bash an operating system?