简体   繁体   中英

Counting words in a apropos command

I have this command apropos -l apple . I want to count the word "apple" from the output of the command. I am a beginner in UNIX commands, and have an idea that I have to use grep or wc , but I'm not sure how. Any help would be appreciated.

apropos -l apple | grep -io apple

There are many options within grep that can help you meet your objective and the above is just an example.

Take the output of apropos -l and then pipe through to grep. With grep, we search for all "apple" entries with -i to show any case combinations. We then finally output the generated list through to wc -l to count the lines and therefore the entries,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM