Hi,
I have a string e.g.
idiotboy|is|trying|to|count|how|many|pipes|are|in|this|string|
How can I count how many pipes there are in the string?
grep only returns the string itself
I can
While read pipe|;do tr -s "|" "|\n" $pipe|wc -l;done
but I thought there might be another way which is perhaps more efficient?
Thanks in advance.
Chris
I have a string e.g.
idiotboy|is|trying|to|count|how|many|pipes|are|in|this|string|
How can I count how many pipes there are in the string?
grep only returns the string itself
I can
While read pipe|;do tr -s "|" "|\n" $pipe|wc -l;done
but I thought there might be another way which is perhaps more efficient?
Thanks in advance.
Chris