I have a file separated by pipe, i have to do a group by a field and get its sum of occurrences.

My input file looks like:

```
96472|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
96472|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
96472|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12
214126|Text1|6|A|City|Austin, TX|0123|9899|2017-02-12

```

This is how I am doing it:

```
cut -d'|' -f1 somefile.txt | cut -d'-' -f1 | sort | uniq -c 
output is 
 3 96472
 10 214126

```

Essentially I want to sum up the occurrence of a field, just like group by clause in sql. so in my example i show that field/column 1 having srepeated values as 3 and 10

I am sure there is a better way to do it. And i also want to filter records which has less the 10 occurrences i do :

```
cut -d'|' -f1 somefile.txt | cut -d'-' -f1 | sort | uniq -c | grep -v 10

```

is there a good way to achieve both?