|
发表于 2019-4-27 22:50:58
|
显示全部楼层
awk is one of the best tools, if not the best, to work with tabular data.
! e- a# T5 @5 {! P. a# Jon the other hand, powerful it is, regular expression is overly used in the wrong places.
# N4 m* h3 B5 U0 j' F; N
* n2 t8 T2 |' o5 }0 t* NTo solve your problem with awk,
& G! P: {) C1 g5 W0 Bawk '{for(i=3; i<=NF; i++) if($i==$2) $i = "" } { print }' 2nd-col.txt > 2nd-cleaned.txt
) w7 u! C# v' b& A e% \: S5 `/ l4 M8 ?8 Z
suppose 2nd-col.txt is your original file and 2nd-cleaned.txt is your cleaned file.& {: P+ k) I% d7 A8 ^
I've uploaded a screenshot, but I'm not sure whether it shows correctly.
1 B# _, [ ]0 Y0 j5 p- E" U+ ?% _$ |/ {6 O( w. z
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|