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 / arup
#!/bin/csh
# Here tr -s ' ' replaces all multiple ' ' with single ' '
# next pipe the above stream to replace each ' ' with '\n'
# next pipe the above stream to get a sorted list of words
# then pipe the unique words to outfile
tr -s ' ' < $1 | tr ' ' '\n' | sort | uniq > $1.out
Is This Answer Correct ? | 20 Yes | 11 No |
Post New Answer View All Answers
What is the use of .sh file?
What is difference between shell and bash scripting?
madhar chod unix ke 10 commands dhang se likh nahi sakta hai
What are the four fundamental components of every file system on linux?
What does $@ mean in shell?
Is shell a scripting language?
What are the different types of shell scripting?
What is the significance of the shebang line in shell scripting?
What is the equivalent of a file shortcut that we have a window on a linux system?
Write a command sequence to find the count of each word?
What is path in shell script?
What is the significance of $#?
What is the best shell scripting language?
Why is used in shell scripting?
what is info area how many types?