I have a text field that has lines with the following format:
game,match_num,list_of_players,game_date
Eg:
Football,1,james,john,jack,09-10-2018
I need to compare lines in the file based on the game and count only the unique lines i,e., count if the game name is not equal. How can I do this using sed
or awk
?
Something like this:
wc -l filename | awk -F, '$1 != $1'
I did not get any output for this command but I want to get the number of lines. So how should I change this command to get the desired output?
awk -F, '!seen[$1]++' filename | wc -l
– Kusalananda Apr 01 '19 at 11:35wc -l
in the beginning instead of at the end. I should still read more about how to use pipes in linux. Your solution is what I was looking for. – Lax_Sam Apr 01 '19 at 11:39