分两类文件处理,分别是CMakelist.txt和其他文件;
步骤:
1.新建两个文件,分别写入需替换的文件头(示例cpp_h.txt和cmakelist.txt);
2.针对源文件和头文件
grep "COPYRIGHT" * -R | awk -F: '{print $1}' | sort | uniq|grep -v "CMakeLists.txt"|xargs sed -i -e '17r /home/xxx/cpp_h.txt' -e '1,17d'
3.针对CMakelists.txt文件
grep "COPYRIGHT" * -R | awk -F: '{print $1}' | sort | uniq|grep "CMakeLists.txt"|xargs sed -i -e '17r /home/xxx/cmakelist.txt' -e '1,17d'