Artificial intelligent assistant

Count distinct values of a field in a file I have a file with one million lines. Each line has a field called `transactionid`, which has repetitive values. What I need to do is to count them distinctly. No matter how many times a value is repeated, it should be counted only once.

OK, Assuming that your file is a text file, having the fields separated by comma separator ','. You would also know which field `'transactionid'` is in terms of its position. Assuming that your `'transactionid'` field is 7th field.


awk -F ',' '{print $7}' text_file | sort | uniq -c


This would count the distinct/unique occurrences in the 7th field and prints the result.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy d2bbf7ad99ea3fcd37a7965095eaef62