Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
239 views
in Technique[技术] by (71.8m points)

How can I use the UNIX shell to count the number of times a letter appears in a text file?

I have a few text files and I'd like to count how many times a letter appears in each?

Specifically, I'd like to use the UNIX shell to do this, in the form of: cat file | .... do stuff...

Is there a way I can get the wc command to do this?

question from:https://stackoverflow.com/questions/1368563/how-can-i-use-the-unix-shell-to-count-the-number-of-times-a-letter-appears-in-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
grep char -o filename | wc -l

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...