Open X-zcer opened 6 years ago
sed -i '/hello/i\1234' testfile
执行完命令后,会将i后面反斜杠后面的内容插入到包含hello关键字行的上面
sed -i '/hello/a\4567' testfile
执行完命令后,会将a后面反斜杠后面的内容插入到包含hello关键字行的下面
sed -i '//a\org.apache.maven.pluginsmaven-surefire-plugin2.19.1' pom.xml
sed -i '/<plugins>/a\<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.19.1</version></plugin>' pom.xml
sed -i '/hello/i\1234' testfile
执行完命令后,会将i后面反斜杠后面的内容插入到包含hello关键字行的上面
sed -i '/hello/a\4567' testfile
执行完命令后,会将a后面反斜杠后面的内容插入到包含hello关键字行的下面