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
Which is better perl or shell scripting?
What lives in a shell?
What is the default shell of solaris?
What does egrep mean?
Can you write a script to portray how set –x works?
What is a shell environment?
I have 2 files and I want to print the records which are common to both.
How to print all array elements and their respective indexes?
How do I run a bin bash script?
What is the syntax of "nested if statement" in shell scripting?
How can we find the process name from its process id?
How do I run a script from command prompt?
How to check if a directory exists?
determine the output of the following command: echo ${new:-variable}
What is bash coding?