Skip to main content

Replace exact word with another in shell with tr command [Resolved]

I want to replace a word with another word in a text file.

file.txt :

alireza fallah

my code :

cat file.txt | tr ali ALI

but I get this :

ALI fALLAh

it replace all 'a's to 'A' , and 'l's to 'L' and 'i's to 'I' .

is there any way to replace just 'ali' to 'ALI' ?


Question Credit: Alireza Fallah
Question Reference
Asked July 13, 2019
Tags: shell
Posted Under: Unix Linux
16 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA