linux怎么批量修改文件内容?
比如:
操作系统是centos7,在两个目录/var/www/example1和/var/www/example2有两个相同的文件student.txt,内容如下:
shool:No.1 School class:class 3 grade:grade 2 name:test
我想把两个目录中的这个student.txt文件的第4行的test分别改成ZhangSan和LiSi,
我想写个shell脚本modify-name.sh来完成这个功能,可是不知道该怎么写,请大神帮写一下,谢谢!
How to batch modify file contents in Linux? -PHP Chinese website Q&A-How to batch modify file contents in Linux? -PHP Chinese website Q&A
Let’s take a look and learn.
不必写脚本,用两条命令就可以解决了。如: