[ale] Bash script question
Byron A Jeff
byron at cc.gatech.edu
Thu May 15 07:28:29 EDT 2003
> Is there a utility that I can run from bash that I can use to determine
> the number of times a certain character appears in a line?
> Example - I want to determine the number of times a comma (,) appears in
> the line:
> Yes, it can be done from Perl, but I would like to do this from bash.
bash presumes to have all of the standard unix commands available. My entry is:
comma_count=$(echo $line | tr -cd , | wc -c)
where the variable line has the Field1,... line in it.
Ale mailing list
Ale at ale.org
More information about the Ale