Replacing text in a file from a list in another file?

前端 未结 4 512
渐次进展
渐次进展 2020-12-21 15:18

I asked this question before but don\'t think I really explained it properly based on the answers given.

I have a file named backup.xml that is 28,000 l

4条回答
  •  清歌不尽
    2020-12-21 15:48

    How about this:

    awk '{print NR-1 ",/\\*\\*\\*/{s/\\*\\*\\*/" $0 "/}"}' list.txt > list.sed
    sed -f list.sed backup.xml
    

    The first line used awk to make a list of search/replace commands based on the list, which is then executed on the next line via sed.

提交回复
热议问题