Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Is shell scripting easy to learn?

1073


What is a boot block?

1084


What is a shell made of?

1006


How do I open a jshell in cmd?

1318


Suppose you execute a command using exec, what will be the status of your current process in the shell?

1117


What is console line?

1024


How will you emulate wc –l using awk?

1598


How to print pid of the current shell?

1044


How do you debug a script?

1124


What shell is bin sh?

1017


Which shell is the best?

1041


What is the difference between bash and shell?

1171


how to get part of string variable with echo command only?

1072


How do I run a powershell script?

1191


Is bash an operating system?

1034