|
发表于 2019-4-27 22:50:58
|
显示全部楼层
awk is one of the best tools, if not the best, to work with tabular data.
9 v& {1 i$ c2 d: b9 U1 mon the other hand, powerful it is, regular expression is overly used in the wrong places. ) o/ o# ^0 `, Q$ @$ H5 ]
; I# O" P1 S" |2 @) j# @To solve your problem with awk,2 k) A+ O; ~9 c4 E
awk '{for(i=3; i<=NF; i++) if($i==$2) $i = "" } { print }' 2nd-col.txt > 2nd-cleaned.txt9 P! S) X. E0 c2 A' D
6 \( p0 R& f# Jsuppose 2nd-col.txt is your original file and 2nd-cleaned.txt is your cleaned file.. I& \+ A4 }: L; b* k( L
I've uploaded a screenshot, but I'm not sure whether it shows correctly.
' X; K( H, s9 c$ `0 c2 {- }
8 I9 O9 Q3 R% {% |: R |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|