I need to cycle through an entire file of unknown size and remove any line in which a given word (passed in as argument 1) appears in a specified column. In addition, I need to keep track of how many lines are removed. I'm assuming this is a job for awk, but I'm having a lot of trouble with it. I've tried working with awk match, but in addition to some other syntactical issues, I'm having trouble getting it to translate the argument into a word. Obviously new to unix...
Katie 1234 4567 blue Ben 3456 2345 purple Alex 7896 6789 blue $ script.sh blue 4
Edits file to:
Ben 3456 2345 purple
2 lines removed
I'm more interested in understanding what I'm doing than just getting the code. Appreciate any help.