JamesD
04-16-2003, 06:58 AM
Hi,
I've been working on several shell scripts for a class that I am following, and I am really stuck on one of the questions. I was wondering if somebody could point me in the right direction as to how to solve this problem. (note: i dont need the whole solution, just a few pointers)
This is the problem:
Write a script that will generate a list containing the words from the file words.dutch.small, including the amount of bytes that each woord consists of. The list should be sorted by the amount of bytes each word is made up of.
Hint: Look at the manual page of wc
Hint: Use command substitution in some way
Note: the words.dutch.small file has one word per line and is sorted alphabetically.
The problem I am stuck on for now is that i cant get wc to work on a single word. If i pass it a word it thinks it is a filename. And we arent allowed to make files in our shell scripts.
I've been working on several shell scripts for a class that I am following, and I am really stuck on one of the questions. I was wondering if somebody could point me in the right direction as to how to solve this problem. (note: i dont need the whole solution, just a few pointers)
This is the problem:
Write a script that will generate a list containing the words from the file words.dutch.small, including the amount of bytes that each woord consists of. The list should be sorted by the amount of bytes each word is made up of.
Hint: Look at the manual page of wc
Hint: Use command substitution in some way
Note: the words.dutch.small file has one word per line and is sorted alphabetically.
The problem I am stuck on for now is that i cant get wc to work on a single word. If i pass it a word it thinks it is a filename. And we arent allowed to make files in our shell scripts.