mac shell
mac shell
mac 中sed命令的参数格式和普通Linux中是不同的
mac:
find ./ -type f -iname "*.css" |xargs sed -i '' 's/dist\///'
find ./ -type f -iname "*.js" |xargs sed -i '' '/^[^#]*alert(/d'
sed参数-i后面需要加上一个空字符串
cent os中:
find ./ -type f -iname "*.css" |xargs sed -i 's/dist\///'
find ./ -type f -iname "*.js" |xargs sed -i '/^[^#]*alert(/d'
判断是否是mac:
#操作系统类型 os_type=`uname -s`
if [ x"$os_type" = x"Darwin" ];then find ./ -type f -iname "*.css" |xargs sed -i '' 's/dist\///' find ./ -type f -iname "*.js" |xargs sed -i '' '/^[^#]*alert(/d' else find ./ -type f -iname "*.css" |xargs sed -i 's/dist\///' find ./ -type f -iname "*.js" |xargs sed -i '/^[^#]*alert(/d' fi # 批量替换文件中的内容 grep "sumk-http-demo" -rl .|xargs -I {} sed -i '' 's/sumk-http-demo/sumk-http-demo2/g' {}
相关推荐
liweihui 2016-12-28
WindowsandLinux 2016-12-13
anglehearts 2020-09-09
beatlinux 2020-08-24
kong000dao0 2020-07-05
linuxhh 2020-06-05
wangrui0 2020-05-11
bluecarrot 2020-04-20
mingyan 2020-03-28
huangzonggui 2020-02-24
SciRui 2020-01-29
viplinux 2020-01-14
举 2020-01-17
cooldatabase 2020-01-06
Idreamlife 2013-04-15
hyfcomeon 2013-06-14
87590393 2013-06-10
文祥的Linux 2013-06-07