How can I count the unique log lines in a text file only until the first - and print the line with the countorg.springframework. - initialization startedorg.springframework. - initialization startedpushAttemptLogger - initialization startedpushAttemptLogger - initialization startedexample resultorg.springframework. 2pushAttemptLogger 2reviewed: https://stackoverflow.com/questions/6712437/find-duplicate-lines-in-a-file-and-count-how-many-time-each-line-was-duplicated
Count unique lines only to a set pattern
awk;grep;sort;uniq;batch jobs
cut -f1 -d'-' inputfile | sort | uniq -ccut -f1 -d'-' will treat the file as dash-delimited and return only the first column in each line.sort is necessary for uniq to work properly.uniq -c shows only unique lines from the sorted input, including a count.