excel中的某一列,其中有重复,怎么查找?(shell命令)

来源:互联网 发布:nginx apache iis 编辑:程序博客网 时间:2024/06/10 19:53

方法一:

假设excel中的数据如图所示,我们要检测error number是否有重复

Error NumberError Name E1223261VsmServiceUnavailable E1232141VsmHostNotFound

将error number与 error name 两列复制到ubuntu下的一个文件file。

[root@jiyou-test-controller tmp]# cat file | awk '{print $1}' | sort > /tmp/ret  

将file的第一行显示,并排序
[root@jiyou-test-controller tmp]# cat file | awk '{print $1}' | sort -u  > /tmp/res

将file的第一行显示,并排序,并删除重复项
[root@jiyou-test-controller tmp]# diff /tmp/ret /tmp/res
6d5
< E0001225
53d51
< E0400004
发现有两个error number 有重复,再到excel中查找error number即可。


方法二:

可使用 excel函数: countif 。

可参见博客http://www.360doc.com/content/11/1223/14/701163_174474562.shtml

我先在"error number"(列A)后插入了一列(列B),在B2单元格输入公式=IF(COUNTIF($A$2:A2,A2)>1,"duplicate")。

然后将鼠标放在单元格右下角,便黑色十字后,向下拖动,扩展到真个列B。结果如下:

 E0001225duplicateMonitorExceptionE0001229FALSENoValidHost E0400003FALSEAddGlobalToCephConfFailed E0400004FALSEAddMdsToCephConfFailed E0400004duplicateAddMonToCephConfFailed
这样就找到了重复的列。

0 0
原创粉丝点击