读取文件的第2列和第4列:
cat filename.txt | awk '{ print $2 $4 }'
求文件file1.txt的第二列 和 file2.txt(单列文件)的交集:
cat file1.txt | awk '{print $2}' | sort > file1_ret.txt
cat file2.txt | sort > file2_ret.txt
comm - file1_ret.txt file2_ret.txt
读取文件的第2列和第4列:
cat filename.txt | awk '{ print $2 $4 }'
求文件file1.txt的第二列 和 file2.txt(单列文件)的交集:
cat file1.txt | awk '{print $2}' | sort > file1_ret.txt
cat file2.txt | sort > file2_ret.txt
comm - file1_ret.txt file2_ret.txt