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


Please Help Members By Posting Answers For Below Questions

How do I start a shell script?

581


one folder contains lot of students name but I want to fetch hello with every student name individually using shell script

522


What are the default permissions of a file when it is created?

501


Explain about sourcing commands?

640


How do we delete all blank lines in a file?

579






How to set an array in linux?

598


What is the command to find out users on the system?

574


How does ls command work?

588


is this growing field and what is average package in this?

1875


wats the deinitions for shell utility and filter?

1849


How to print all the arguments provided to the script?

557


What are the different commands available to check the disk usage?

497


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

1857


What is k shell?

537


How would you compare the strings in a shell script?

547