I am trying to write a script that filters for certain words.
This is the method I was using. it was working well but when the number of possible matches became too large it doesn't do the job anymore. I am not sure if this method has some sort of limitations. So any alternatives are welcome.
str="He is driving a car"
if [ "$str" != "${str/car/}" ] || [ "$str" != "${str/bus/}" ] || [ "$str" != "${str/truck/}" ] || [ "$str" != "${str/vehicle/}" ];then
echo "Substring found"
else
echo "Substring not found"
fi