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 bash an operating system?
Explain about the slow execution speed of shells?
What is the first line in every perl script called?
Is shell scripting difficult?
Is shell a scripting language?
How are shells born?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
What is a batch file used for?
How would you compare the strings in a shell script?
What are the two files of crontab command?
Write a shell script that adds two numbers if provided as the command line argument and if the two numbers are not entered throws an error message.
How to get the last line from a file using just the terminal?
What is inside a seashell?
How do I run a shell script on a mac?
What is a boot block?