Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有逗号分隔的文件,基本上具有以下结构:
1, 2, 3, 4, 5 ,,,, 6 等
我必须计算唯一的第 6 列的数量。请帮忙
(顺便说一句,这是对 unix/linux 类的介绍,因此应该可以使用基本命令来完成)
cut -d "," -f 6 myFile |sort |uniq -c |wc -l
看着我的水晶球,我看到你们班正在讨论awk。尝试
awk
awk -F, '!a[$6]++{c++} END{ print c }' input-file