找到文件里带有tab键的行
$ cat test.txt
dong line1 end
dong line2 end
dong line1 end
dong line2 end
$grep -P 'dong\tline' test.txt
dong line1 end
$grep -Po 'dong\tline' test.txt
dong line
把文件按固定格式显示,用来显示非打印字符的值
od -Ax -w32 -tcx1 test.txt
-Ax 输出的第一列是位置偏移信息,单位为十六进制(-x参数);
-w32 把文中的数据
输出的
每行有32列;
-tcx1 输出的一列为1字节,十六进制(-x参数), 同时显示字符值(-c参数)
找到文件里含有 class或extern的行
grep -Pl 'class.*extern|extern.*class' /tmp/*.c
取出两个文件中相同的行 grep -wf file1 file2
取出两个文件中不
相同的行
grep -vwf file1 file2