Quote:
|
Originally Posted by vino
What do you want to do ?
Find the number of occurences of a certain character in a string, or, are you looking for the all the positions where the character appears ?
For number of occurences you can do
Code:
echo "$string" | grep -c "r"
|
Hi Vino,
With due regards, I would like to say that the above may not solve the problem, OP is having. He is looking for no. of occurence of a character in a string. And the above command will give always give output as 1 if there is one or more than one occurence of "r"
Kindly correct me if I am wrong
Gaurav