Bash: count lines that occur together

I’ve been working on a script that will take in a css file as a txt file. The end result would be that the script would count the number of properties that occur more than once, which i have achieved, and to count the occurences of properties which appear as part of a group, e.g.

2 font-size:10px; + font-family:Helvetica;
3 width:100%; + height:inherit; + width:auto;
...etc

at the minute, my bash script will remove all block comments, leading and trailing whitespace, braces and css rule names from the txt file, leaving each property:value pair on its own line, and these are then counted and output to another file. Leaving out the part where css rule names and braces are removed, how would i go about finding and counting pairs/groups of properties and how often they occur?


Source: bash

Leave a Reply