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!