Optimize shell script for multiple sed replacements

前端 未结 7 1891
清歌不尽
清歌不尽 2020-12-19 08:50

I have a file containing a list of replacement pairs (about 100 of them) which are used by sed to replace strings in files.

The pairs go like:



        
相关标签:
7条回答
  • 2020-12-19 09:18

    You can use sed to produce correctly -formatted sed input:

    sed -e 's/^/s|/; s/$/|g/' replacement_list | sed -r -f - file
    
    0 讨论(0)
提交回复
热议问题