Reputation: 49
without using sed or awk
I tried this command to solve this problem
tr Ac Ze
but this command doesn't work Does any help, please?
Upvotes: 0
Views: 3598
Reputation: 420
You can use sed
command:
$ -> echo Aca | sed 's/A/Z/g; s/c/e/g'
Zea
Or just use tr
command as said @James
$ -> echo Aca | tr Ac Ze
Zea
Another example:
#!/bin/bash
read -p "Insert word: " word
echo $word | tr Ac Ze
Result:
Insert word: Aca
Zea
Or:
#!/bin/bash
read -p "Insert word: " word
echo $word | sed 's/A/Z/g; s/c/e/g'
Aditional info:
$ -> whatis tr
tr (1) - translate or delete characters
$ -> whatis sed
sed (1) - stream editor for filtering and transforming text
Upvotes: 2