I am a total beginner in UNIX/Shell script. I am in the process of creating a huge script for a spellchecker program. What it does is spellcheck files and throws output in a temporary file. What I need help in is forming a for loop where it will output each misspelled word, one at a time asking user to correct it or leave it misspelled. Now the corrections go to another temporary file and the words that are not corrected goes to another file. I need to use grep to find and sed to replace each occurence of the same word. I am stuck at this part for over 2 weeks ....Please please help if anyone can. I will really appreciate all or any suggestions. I will post what i have ...
filename1=file where output of spell is in
filename2= file where corrections are going
filename3=words not corrected are directed
for $word in `cat filename1`; do
grep -n $word $filename1 | echo "incorrect $word"
echo "do you want to fix the incorrect word"
echo -n "c)orrect, m)ove"
if [ "$in" = "c" -o "$in" = "correct" ] ; then
sed "s/$word/$in/g" >> $filename2
elif [ "$in" = "m" -o "in" ="move" ] ; then
$word >> $filename3
Thanks very much.