My usual idiom for counting the number of occurrences of a given line in some text input is
… | sort | uniq -c | sort -n
with the last
sort -n optionally used to sort lines by occurrence count. However, I recently encountered a situation where the first three lines of the data were a header, and including them with the sorting and counting greatly reduced legibility.
What's the most elegant way to merely indent the first three rows of the input (to account for the count field) but not sort them?