需求
找出两个文本文件的重复数据
$wc -l sms.txt
13659910 sms.txt
$wc -l tmp_sms.txt
154 tmp_sms.txt
-l, --lines
print the newline counts
步骤
查看编码
$file sms.txt
sms.txt: UTF-8 Unicode text
$file tmp_sms.txt
tmp_sms.txt: ASCII text, with CRLF line terminators
转码
统计每行长度
$head -n1 list1.txt |wc -c
12
$head -n1 list2.txt |wc -c
13
-c, --bytes
print the byte counts
文本类型每一行都是一个电话号码,应该是11位
查看特殊字符
$head -n1 list2.txt | cat -A
17783217065^M$
$head -n1 list1.txt | cat -A
18008314510$
-A, --show-all