我想读取filein.txt(制表符分隔),并输出一个fileout.txt,只有与给定列的值相匹配的行,并消除正在查询的列.即,
filein.txt #name\thouse\taddress roger\tvictorian\t223 dolan st. maggie\tfrench\t12 alameda ave. kingston\tvictorian\t224 house st. robert\tamerican\t22 dolan st.
让我们说,我想只选择那些房子是维多利亚风格的行,那么我的fileout.txt应该是:
fileout.txt #name\taddress roger\t223 dolan st. kingston\t224 house st.
解决方法
awk -F"\t" '$2 == "victorian" { print $1"\t"$3 }' file.in