|
发表于 2019-4-27 22:50:58
|
显示全部楼层
awk is one of the best tools, if not the best, to work with tabular data. . X" I. r6 t+ E0 t! @
on the other hand, powerful it is, regular expression is overly used in the wrong places. : K9 M# }8 R% M2 b' S; V% [8 N# F& L
; T+ U1 F; t2 I9 h Q
To solve your problem with awk,
/ M8 J5 e0 P3 y2 Y+ K; Bawk '{for(i=3; i<=NF; i++) if($i==$2) $i = "" } { print }' 2nd-col.txt > 2nd-cleaned.txt9 ~1 d- F9 s9 V
# o3 n3 P8 i0 p3 q Q! rsuppose 2nd-col.txt is your original file and 2nd-cleaned.txt is your cleaned file.
) g- o% Q0 c9 I) H2 `I've uploaded a screenshot, but I'm not sure whether it shows correctly.
/ h$ F7 B8 f1 J2 F
4 }5 `! v/ T$ E: j1 R; M5 s3 j! a |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|