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 are types of shells?
How does path variable work?
How would you compare the strings in a shell script?
What can you do with powershell?
What is the first line of a shell script called?
What is awk in shell script?
I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
What is a beat in a script?
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.
What language is bash written in?
How to get the 3rd element/column from each line from a file?
What are the advantages of shell scripting?
How to find all the files modified in less than 3 days and save the record in a text file?
What is shell application?
Why is it called a shell?