Parsing xml to and replacing specific tags shell script

前端 未结 3 1032
抹茶落季
抹茶落季 2021-02-10 02:40

For the below xml ,I need to replace for CLASSA to failed

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-10 03:28

    xlmlint, as the name implies, is for parsing and validating XML, not editing it. If you can install xmlstarlet on your cluster, you can do the following:

    xmlstarlet ed --update "/studentFile/student[studentName='CLASSA']/studentActions/studentAction[studentType='Juniour']/studentStatus" --value "Failed" *file*
    

提交回复
热议问题