Re: counting commas
Hi,
Greg Wooledge wrote:
> unicorn:~$ string="apple,banana,cherry,date"
> unicorn:~$ commas=${string//[!,]/}
> unicorn:~$ echo "${#commas}"
> 3
Always astonishing what a good bashism can do.
> But at this point, we have to wonder what the *actual* goal is.
Up to now we only know about the astonishment of fxkl47BF@protonmail.com
that grep -c does not count characters.
For a more complicated use case i would write a little C program where
i'd be in control of every single bit of throughput.
(Ok, C causes scars on the programmer's self esteem. But what does not
kill me makes me just stronger. I'm a vim user.)
Have a nice day :)
Thomas
Reply to: