#!/bin/bash -x
tt=" ./kernel-tests/socinfo/Android.mk"
#for a in `grep -rsn LOCAL_MODULE_TAGS . | awk -F ":=" '{print $2 }' `
#grep -rsn LOCAL_MODULE_TAGS . > ../new.txt
sed -i "s/\(^LOCAL_MODULE_TAGS.*\)/LOCAL_MODULE_TAGS := eng user /g" $tt
-i 表示真实修改
^ 表示从开头匹配
.* 表示匹配到行末尾
\(...内容.....\)
LOCAL_MODULE_TAGS := eng user 提示替换的内容
/g 表示全部修改
完善一下:
#!/bin/bash -x
tt=" ./kernel-tests/socinfo/Android.mk"
#for a in `grep -rsn LOCAL_MODULE_TAGS . | awk -F ":=" '{print $2 }' `
#grep -rsn LOCAL_MODULE_TAGS . > ../new.txt
#cat list.txt | while read line
for x in `cat list.txt`
do
sed -i "s/\(^LOCAL_MODULE_TAGS.*\)/LOCAL_MODULE_TAGS := optional eng user /g" $x
done
#
# for x in ` awk -F "="'{print $2 }' `
# do
# echo $x
# sed -
# done
~
~