Help with grep inside an if loop

Hello All,

I have been reading posts on here for a while, but this is my first post. I have a document in which many sentences appear, and I am piping it through an exterior script which will tag each word in the document with its part of speech (not part of my script, just background). The output of this working script is vertical; that is, column 1 has the original word, column 2 has its part of speech, and column 3 is unimportant. A typical line of text becomes this when run through the part of speech tagger:

adam01.cha    JJ    adam01.cha
:    :    :
*CHI    NN    *chi
:    :    :
I    PP    i
beat    VVP    beat
drum    VV    drum
.    SENT    .

I need to find every instance that certain words appear when tagged as 'VVN', find that specific instance of that word in the original document, and delete it.

I want to search the document line by line using a series of if statements (each if statement should be evaluated on each line). I also decided to run a counter, and use that number to find the line of the original document, where I could then delete that line. Currently, though, my code is only outputting the list of words in the for loop, and I can't get it to enter the first if inside of the while loop.

My code is below:

for var in bent bound bled bred brought built burned burnt bought caught clung crept dealt dug dived dreamed dreamt fed felt fought found fled flung ground hung heard held kept knelt laid led leaped leapt learned learnt left lent lighted lost made meant met misspelled misspelt mowed mown paid pled proved proven sawed sawn said sought sold sent sewed sewn shaved shaven shone shoed shod shot showed sat slept slid slung sowed sown sped spent silted spilt spun sprung stood stuck stung struck strung swept swelled swollen swung taught told thought thrived understood upheld waved woven wept wound won withheld withstood wrung 
do
    cd ~
    cd Documents/UPenn/'Senior Year'/'Spring 2011'/Thesis/Results/
    echo "$var"
    NUMLINE=0
    while read -r line
    do
        if grep "#|Number|CHI"* >/dev/null; then
            NUMLINE=`expr $NUMLINE + 1`
        else 
            if grep "$var    VVN"* >/dev/null; then 
            sed -i '$NUMLINE' d Brown_Adam_CIVForms.txt
            fi
        fi
    done < foradam.txt
done 

Help is greatly appreciated - thank you all in advance!

Here is a basic script to search a given directory for a key word. To execute it if it was saves with the file name of test then it would be executed by typing ./test (directory path) (keyword)
of course this is after the permissions was edited by chmod 755 (filename)

#!/bin/bash

count=0
   currcount=0
   maxcountfile=0
ls $1 > directory
exec 0<directory
   while read filename
   do
      nums=$(grep -o $2 $1/"$filename" | wc -l)
      if [ $nums -gt $currcount ]
         then
         currcount=$nums
         say="File $filename has $nums occurrences of $2"         
      fi 
   done
echo $say

Thanks for the help! I made some changes, but I am still having problems. Now I am getting thrown the following:

./Present.sh: line 35: syntax error near unexpected token `done'
./Present.sh: line 35: ` done '

Any help is appreciated!

The current code I am using:

for var in bent bound bled bred brought built burned burnt bought caught clung crept dealt dug dived dreamed dreamt fed felt fought found fled flung ground hung heard held kept knelt laid led leaped leapt learned learnt left lent lighted lost made meant met misspelled misspelt mowed mown paid pled proved proven sawed sawn said sought sold sent sewed sewn shaved shaven shone shoed shod shot showed sat slept slid slung sowed sown sped spent silted spilt spun sprung stood stuck stung struck strung swept swelled swollen swung taught told thought thrived understood upheld waved woven wept wound won withheld withstood wrung 
do
	cd ~
	cd Documents/UPenn/'Senior Year'/'Spring 2011'/Thesis/Results/
	echo "$var"
	NUMLINE=0
	cat foradam.txt | while IFS=$'\t' read -r word pos other; do
		if [ # = "$word" ] || [ Number = "$word" ] || [ CHI = "$word" ]; then
			NUMLINE=`expr $NUMLINE + 1`
			echo "error 1"
			echo "$word"
			echo "$NUMLINE"
		if [ "$var" = "$word" ] && [ VVN = "$pos" ]; then 
			sed -i '$NUMLINE' d Brown_Adam_CIVForms.txt
			echo "error 4"
			echo "$word"
			echo "$NUMLINE"
		else
			echo "nothing on this line"
			echo "$word"
			echo "$NUMLINE"
		fi
	done 
done

Put quotes around fixed strings you are testing for:

if [ "#" = "$word" ] || [ "Number" = "$word" ] || [ "CHI" = "$word" ]; then[
...
if [ "$var" = "$word" ] && [ "VVN" = "$pos" ]; then 

Sed needs 1 argument for sed string and env vars must be in double quotes to be expanded, see use of ${var} when followed by alphanum:

sed -i "${NUMLINE}d" Brown_Adam_CIVForms.txt