7 ms·
Interestingly, locale can change one answer. with LC_COLLATE=en_US.UTF-8, sort faces.txt | uniq -c 5 (◕‿◕) uniq treats (︺︹︺) as equal to (◕‿◕). Copied the
by rando832 10y ago
Interestingly, locale can change one answer.
with LC_COLLATE=en_US.UTF-8,
sort faces.txt | uniq -c
5 (◕‿◕)
uniq treats (︺︹︺) as equal to (◕‿◕).
Copied the file to my machine to test.
- sebbsnoprocrast 10y agoI, too, ended up copying the file to my machine. I also ended up with this: https://gist.github.com/daveloyall/63485c5a08882432b138c0917d264e3b https://gist.github.com/daveloyall/63485c5a08882432b138c0917...
- schoen 10y agoI didn't think we were allowed to even potentially change the order, so I used awk '{if (!c[$0]) { print }; c[$0] = 1 }'
- rando832 10y agoOh ya, I shouldn't have said answer, because uniq is not a way to the answer, just something I naturally reached for while trying to figure out an answer.
- _druu 10y agoawk '!a[$0]++' faces.txt is a touch shorter ^^
- schoen 10y agoThat's the same approach used by the challenge's original creator (in the GitHub link above). It's a clever solution!