How do I ad an if statement (regarding punctuation in a word) to this bash script

view full story

http://unix.stackexchange.com – I have this bash script #!/bin/bash cat $@ | while read line do for word in $line do echo $word | circling-the-square # here's where i need to add the if statement: #if the word contains one of the four [!?.,], #then also echo that punctuation mark done done circling-the-square is a Python script based on Norvig's spelling corrector. That script rids its input of punctuation def words(text): return re.findall('[a-z]+', text.lower()) so I need bash to notice this. I guess sed or awk might be useful but I still don't know how to write that rege (HowTos)