I want to delete the occurrence of a character in a string only for the first occurrence.
Example:
echo "B123_BACK" | tr -d 'B'
This results in output:
123_ACK
How can I delete only the first occurrence of charcater 'B'
so that the output looks like
123_BACK
Looking at the tr
man page, this isn't possible. Why not use sed
instead:
echo "B123_BACK"|sed 's/B//'
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments