how to edit XML using bash script?

后端 未结 4 1274
终归单人心
终归单人心 2020-11-29 11:29

1
2

Need to change values 1 and 2 from bash

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 12:16

    You can use the xsltproc command (from package xsltproc on Debian-based distros) with the following XSLT sheet:

    
    
      
      
      
    
      
        
          
        
    
      
      
        
          
        
      
    
      
        
          
        
      
    
    

    Then use the command:

    xsltproc --stringparam tagReplacement polop \
             --stringparam tag1Replacement palap \
             transform.xsl input.xml
    

    Or you could also use regexes, but modifying XML through regexes is pure evil :)

提交回复
热议问题