Sed using regular expressions

前端 未结 3 1500
借酒劲吻你
借酒劲吻你 2021-01-25 09:53

So basically I have a original list of 1500 names with a 4 digit number associated with each name. I have another file which contains 200 of these 1500 names with a new 4 digit

3条回答
  •  一向
    一向 (楼主)
    2021-01-25 09:55

    You can generate a sed script from the update field like

    sed 's:\(.*AY\)\d\+:/\1/s_.*_&_:' UPDATEFILE > SEDUPDATE.SED
    

    Then run the generated script on the original file like:

    sed -f SEDUPDATE.SED ORIGINAL_FILE
    

提交回复
热议问题