我有一个csv文件
FILE.CSV
C75ADANXX,5,20,,AGGCAGAA,AGAGTAGA,,,,,AB
C75ADANXX,5,21,,AGGCAGAA,GTAAGGAG,,,,,AB
C75ADANXX,5,22,,AGGCAGAA,ACTGCATA,,,,,AB
C75ADANXX,5,23,,AGGCAGAA,AAGGAGTA,,,,,TC
C75ADANXX,5,24,,AGGCAGAA,CTAAGCCT,,,,,TC
C75ADANXX,5,25,,TCCTGAGC,GCGTAAGA,,,,,TC
当我运行以下awk命令时:
awk -F "," '{print$11}' file.csv ##prints last cloumn
我想用TC提取线条;但是以下命令不打印任何内容
awk -F "," '{if($11==TC){print$0}}' file.csv
我在编写命令时出错了?谢谢。
答案 0 :(得分:1)
将命令修改为
awk -F "," '{if($11=="TC\r"){print$0}}' file.csv
这个文件是从Windows复制的,它在行尾有一个回车符,当你只打印最后一列时显然没有看到。
答案 1 :(得分:0)
尝试这个
grep",TC $" FILE.CSV