|
发表于 2019-4-27 22:50:58
|
显示全部楼层
awk is one of the best tools, if not the best, to work with tabular data.
7 H/ q% U8 C* \/ t6 w5 Q: Uon the other hand, powerful it is, regular expression is overly used in the wrong places.
( O! O$ T1 `1 k# r5 n: `6 ~8 P2 ?' g# M
To solve your problem with awk,
7 x3 q+ r; Y& s. p A$ ^' Tawk '{for(i=3; i<=NF; i++) if($i==$2) $i = "" } { print }' 2nd-col.txt > 2nd-cleaned.txt
" o) n/ ~! |8 b3 H' |. A* Q; u) \" j9 D( W3 ~* ^
suppose 2nd-col.txt is your original file and 2nd-cleaned.txt is your cleaned file.
9 R( _% c) {) p+ wI've uploaded a screenshot, but I'm not sure whether it shows correctly.
* u, @' l# b- N) {+ _: j$ S, w) _" b3 @8 I3 H6 d" B
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?免费注册
x
|