shell脚本

原创
2020/12/31 22:00
阅读数 183

1.对当前文件夹下的所有以.sisc后缀的文件,都把.sisc去掉
参考:
https://blog.csdn.net/u013991521/article/details/80531019
https://blog.51cto.com/mofansheng/1743432

for file in `ls | grep .sisc`
do
  mv $file `echo $file | sed 's/.sisc//g'`
done

2.对多层文件夹遍历

#!/bin/bash

for multiplier_name in ~/Desktop/dc_GAO/*
do
        cd ${multiplier_name}
        for dc_dir in ./*
        do
                cd ${dc_dir}
                echo `pwd`
                cd scripts/
                sed -i '2,3 s/^/#/' constraints_seq.tcl
                sed -i '11,13 s/#//' constraints_seq.tcl

                echo ${dc_dir}
                case ${dc_dir} in
                        "./dc1")
                                sed -i '19 s/1000/2/' constraints_seq.tcl
                                ;;
                        "./dc2")
                                sed -i '19 s/666.67/1/' constraints_seq.tcl
                                ;;
                        "./dc3")
                                sed -i '19 s/500/0.7/' constraints_seq.tcl
                                ;;
                        "./dc4")
                                sed -i '19 s/400/0.5/' constraints_seq.tcl
                                ;;
                        "./dc5")
                                sed -i '19 s/333.33/0.4/' constraints_seq.tcl
                                ;;
                        *)
                                echo ERROR
                                ;;
                esac
                cd ../..
        done
        cd ..
done
#!/bin/bash

for multiplier_name in ~/Desktop/dc_GAO/*
do
        cd ${multiplier_name}
        for dc_dir in ./*
        do
                cd ${dc_dir}
                echo `pwd`
                #sed -i '2,8d' .synopsys_dc.setup
                #sed -i '1a \ \ /home/wllpro/llwang/Desktop/zli/SMIC_65nm/lib \\' .synopsys_dc.setup
                sed -i '12 s/^/#/' .synopsys_dc.setup
                sed -i '18,20 s/#//' .synopsys_dc.setup
                #sed -i '1a \ \ /home/wllpro/llwang/Desktop/zli/SMIC_65nm/physical_lib \\' .synopsys_dc.setup
                cd ..
        done
        cd ..
done
#!/bin/bash

for multiplier_name in ../dc_SZheng/*
do
        cd ${multiplier_name}
        for dc_dir in ./*
        do
                cd ${dc_dir}
                echo ${multiplier_name} : ${dc_dir}
                cd reports
                sed -n '/Total area/p' *area.rpt
                sed -n '/data arrival time/p' *timing.rpt
                sed -n '/slack/p' *timing.rpt
                sed -n '/Total Dynamic Power/p' *power.rpt
                cd ..
                cd ..
        done
        cd ..
done
BEIN
{
LAST_DC_SEQ = ""
}
{
if ($0 ~ /dc/) {
        if ($3 == $LAST_DC_SEQ) {
                printf ", "
                LAST_DC_SEQ = $3
        }
        else{
                printf "\n" $1 ", "
                LAST_DC_SEQ = $3
        }
}
else if ($0 ~ /area/)
        printf $3 ", "
else if ($0 ~ /time/)
        printf $4 ", "
else if ($0 ~ /slack/)
        printf $3 ", "
else if ($0 ~ /Power/)
        printf $5 ", "
}

awk -f process_data.awk file

展开阅读全文
加载中

作者的其它热门文章

0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部