Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以将这些组合在一行中以提高效率。
awk '$4 ~/^[x]/' raw.txt > x_raw.txt awk '!/y/' x_raw.txt > xy_raw.txt
这可能与perl有关吗?
您不需要切换到 perl 来执行逻辑 AND 只需使用 operator &&。以下打印第四个字段以开头x且该行不包含的行y:
&&
x
y
awk '$4~/^x/&&!/y/' raw.txt > xy_raw.txt