|
发表于 2019-4-27 22:50:58
|
显示全部楼层
awk is one of the best tools, if not the best, to work with tabular data. " y. |2 o& A3 X! {1 E% ~7 |
on the other hand, powerful it is, regular expression is overly used in the wrong places.
4 `- g. q+ [7 @6 g6 U. D' c4 w
6 f3 V+ A) A# f# p) M! j1 `To solve your problem with awk,$ d* w7 b& x0 g
awk '{for(i=3; i<=NF; i++) if($i==$2) $i = "" } { print }' 2nd-col.txt > 2nd-cleaned.txt
' p/ M8 A( {, u/ c( [
2 q: D% @ W9 Esuppose 2nd-col.txt is your original file and 2nd-cleaned.txt is your cleaned file.1 S4 i1 ?! f0 [" ^6 m8 c2 o
I've uploaded a screenshot, but I'm not sure whether it shows correctly.
# ~% _9 o2 L3 i6 J ?1 ~+ L6 R9 v! r
) r0 z0 p1 J. t, b' ?$ S |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|