понеділок, 27 липня 2015 р.

Unix: how to replace, delete and add new string in file

1. delete all lines which have tag <module> in pom.xml
sed -i -e 's/<module>.*//' /home/pom.xml

2. paste a specific module in pom.xml
sed -i -e '/<modules>/a\<module>$MODULE</modules>' $WS/smokes

3. replace word "param" by new word "avro" inglobally in pom.xml file
sed -i -e 's/param/avro/' /home/pom.xml

Немає коментарів:

Дописати коментар