linux/unix shell bash script 小记

#script
for i in `zgrep -l $1  PSAATL11*`
do
        for j in `zgrep -n $1  $i | awk -F ':' '{print $1}'`
                do
                ((k=j+1));
                m=$(zcat $i | sed -n ${j},${k}p);
                echo $m;
                #echo $m |awk -F ' ' '{print $5}';
        done
done


#指定行数语法点:

sed -n <start_line_num>,<end_line_num>p file


#输出分割后字段语法:

awk -F '<delimitor>' '{print $num}'


#变量增减

((j=j+1))


#for 循环

for i in ....

do

  xxx

done

 

posted @ 2018-02-28 15:09  西番莲果汁  阅读(481)  评论(0编辑  收藏  举报