Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Try using sed if that is possible:
sed
echo $input"$input" | sed 's/\bst\b/street/g'
\b in GNU sed refers to word boundaries.
\b
Also refer: https://unix.stackexchange.com/questions/184815/how-can-i-find-and-replace-only-if-a-match-forms-a-whole-wordHow can I find and replace only if a match forms a whole word?
echo $input | sed 's/\bst\b/street/g'
Also refer: https://unix.stackexchange.com/questions/184815/how-can-i-find-and-replace-only-if-a-match-forms-a-whole-word
echo "$input" | sed 's/\bst\b/street/g'
Also refer: How can I find and replace only if a match forms a whole word?