echo "123ab efab ef123" | sed -r -e 's/(ab[[:blank:]]ef){2}/OK/g'\ -e 's/[[:digit:]]{3}/OK/g' OKOKOK