I have several files in a directory with this kind of content:
Wood *
Nails
Large Hammer *
Wood *
Nails
Large Hammer *
Some names have a star after them, some don't. I have multiple files with such content. In each file a product may or may not have a single star next to it. I need to make a bash script to count the number of star occurencesoccurrences for each individual product in all the files. For example, the output needs to be like this:
Wood 12
Yellow Lamps 6
Nails 4
...
Wood 12
Yellow Lamps 6
Nails 4
...
Which means that in all the files it found 12x a star next to Wood, 6x a star next to the lamps, etc...
It's pretty easy to parse it in C for example, but iI don't want a binary to run,. I want a shell script, and I'm not as versatile with grep and awk, which I'm sure I need here.
I know how to count the stars per se, but I'm not sure how to keep track of which star count belongs to which product.