Question
Examine the file dictionary.words, which contains a list of words, one per line. Sort and put the output into a file sorted.words. Lets take the
Examine the file dictionary.words, which contains a list of words, one per line. Sort and put the output into a file sorted.words.
Lets take the last command as the crude implementation of an English spelling checker. This implementation mishandles the input file sorted.words! Write a shell script named myspell that fixes this problem. Your script should read from standard input and output misspelled words to standard output, for a suitable definition of "words". The shell command:
myspellshould output nothing.
My question- Why does it mishandle the input of the same file? Is it because the left side for comm processes too much, beyond the right side's processing so it is too different?
Also, how could I account for these three test cases:
1: dictionary.words , should output nothing
2: list of English words without any non-alphabetical characters, and output the misspelled words.
3: number 2 with some punctuation marks, which you should be able to ignore them and output the same results as the previous case
tr -cs AZaz[ ] sort u comm - sorted.words tr-cs 'A-Za-z' '[ *]' | sort -u | comm -23 - sorted. words
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started