Check your version of grep and see if it supports the -o option. -o matches each copy of the pattern and puts it on a separate line. You can then pipe the results into wc -l to get the total count for that character.
On Mon, 2009-10-26 at 23:02 +0000, [email protected] wrote: > > Hi all, > > > > Can anyone tell me a unix command that will count the number of tab > characters in a unix regular file? I'm using the wc command to return bytes, > lines, etc but now I need to count ONLY the tabs. For some reason, I thought > grep -c would work for me but forgot that that only returns the number of > lines that have a tab character. I could open the file sequentially and > count but I need something that is fast fast fast. > > > > Thanks > _______________________________________________ > U2-Users mailing list > [email protected] > http://listserver.u2ug.org/mailman/listinfo/u2-users -- Ben Souther Manager, Web and Web Service Development [email protected] | 508.927.8147 FWDavison & Company, Inc. 10 Cordage Park Circle, Suite 200 Plymouth, MA 02360-7318 CONFIDENTIALITY NOTICE: This e-mail message, and any accompanying documents, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, distribution or copying is prohibited. If you are not the intended recipient, please contact our office by e-mail or by telephone at (508) 747-7261 and immediately destroy all copies of the original message. _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
