mrimagepueblo
Programmer
I've gone all around this but am not getting what I need. I want to count the number of times a word appears in a text file, but instead of showing the total number of times it occurs, I only want to show the number of lines it occurs in.
This is what I have, but it's actually counting all the occurences. I've tried all kinds of different things with grep and word count, but not getting what I need. I will duplicate the magical formula for a list of cities I have.
$Alburg = `grep -c 'Alburg' < $data_file_path`;
This is what I have, but it's actually counting all the occurences. I've tried all kinds of different things with grep and word count, but not getting what I need. I will duplicate the magical formula for a list of cities I have.
$Alburg = `grep -c 'Alburg' < $data_file_path`;