Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Finding the count of a word in a list of files in linux

I have a list of files(more than 300) with similar names. Example:
abc01, abc02, abc03…..
How can I find the number of times a specific word occurs in all these files in linux?
I have used this:

cat abc* | grep 20211203 | wc -l

Suppose i need to find a list of specific dates in the format yyyymmdd from these files and their counts, what should i include more?For example if there are value 20211203 is occuring 4 times and the value 20211202 is occuring 12 times and so on, is there a way to get the list of these value(like the format given below)?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

4 20211203

12 20211202

.

.

. and so on

>Solution :

Try this:

cat abc* | grep -c word

where word is your word to be searched.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading