Here is my problem: Any number of lines of text is given from standard input. Output: number of non repeating lines
INPUT:
She is wearing black shoes. My name is Johny. I hate mondays. My name is Johny. I don't understand you. She is wearing black shoes.
OUTPUT:
2
You can use the combination of the SUM and COUNTIF functions to count unique values in Excel. The syntax for this combined formula is = SUM(IF(1/COUNTIF(data, data)=1,1,0)). Here the COUNTIF formula counts the number of times each value in the range appears.
The Unique Count measure gives the number of unique (distinct) values in a column. Empty values are not counted. In the table below, column A has a unique count of two and column B has a unique count of three.
The trick is to "feed" the entire range to UNIQUE so that it finds the unique combinations of values in multiple columns. After that, you simply enclose the formula in the ROWS function to calculate the number of rows.
You could try using uniq man uniq
and do the following
sort file | uniq -u | wc -l
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With