replace text based on a dictionary

前端 未结 3 933
独厮守ぢ
独厮守ぢ 2021-01-06 07:17

I need to do something similar to this post (but with a twist). That is why I am asking.

unix shell: replace by dictionary

I have a dictionary(dict.txt). I

3条回答
  •  温柔的废话
    2021-01-06 07:50

    This might work for you (GNU sed):

    sed '/./!d;s/\([^ ]*\) *\(.*\)/\\|\1|s||\2|g/' dict.txt | sed -f - user.txt
    

提交回复
热议问题