文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > shell脚本总结
侵权投诉

shell脚本总结

#####################
#diff说明: #
#d:前有后没有 #
#1d0 #
#< 1 #
# #
#a:后有前没有 #
#0a1 #
#> 1 #
# #
#c:前后都有但不一样 #
#1c1 #
#< 1 #
#--- #
#> 3 #
#########################

awk '
begin{
i=1;
endline=0;
}
{
if(length($0)<=9){
if( index($0, "c")>0){
endline=i+4;
}
else if(index($0, "a")>0){
endline=i+2;
}
else if(index($0, "d")>0){
endline=i+2;
}
}
if(i<endline){
printf $0;
}
i++;
}'


awk '
begin{
i=1;
endline=0;
}
{
if(length($0)<=9){
if(index($0, "a")>0){
endline=i+2;
}
}
if(i<endline){
printf $0;
}
i++;
}'

cat diff_a.txt|grep ">" |grep "vc" |awk -F "|" '{print $6}' |sort -u >vc_msisdn
cat diff_c.txt|grep ">" |grep "vn" |awk -F "|" '{print $6}' |sort -u >vn_msisdn
cat diff_c.txt|grep ">" |grep "vc" |awk -F "|" '{print $6}' |sort -u >vc_msisdn_c





cfg_file=$1
file=$2
cat $file | awk -f "/" -v cfg_file=$cfg_file '
begin{
while(getline line < cfg_file){
split(line,fileds," ");
serial=fileds[0];
value[serial]=fileds[1];
line_number=serial;
}
while(i<line_number){
printf value[i]"|";
i++;
}
printf "\n";
}
{
while(i<line_number){
printf $i"|";
i++;
}
printf "\n";
}
'



ingw2-billapp2:/work11/ruanxingke/shell_test>cat a
123/456
123/456
123/456
123/456
123/456
123/456
456/123
256/123
456/123
556/123
656/123
ingw2-billapp2:/work11/ruanxingke/shell_test>cat b
123
456
789

#将a文件中第一个域在b中出现过的打印出来,切记:awk中使用BEGIN时一定要大写!!!小写不管用!!!
bfile=b
awk -F "/" -v bfile=$bfile 'BEGIN{
while(getline linea < bfile){
H[linea]="aaaa";
}
}
{
if( H[$1]=="aaaa" ){
printf $0"\n";
}
}' a




ingw2-billapp2:/work11/ruanxingke/shell_test>cat cfg.txt
0 msisdn 0
1 user_type 1
2 sm_type 2
3 billing_type 3
4 sp_code 4
5 service_code 7
6 fee1 10
7 fee2 11
8 old_fee1 13
9 old_fee2 14
10 end_datetime 20
11 present_info 21
12 oper_code 22
13 bill_month 8
14 acct_type 8
ingw2-billapp2:/work11/ruanxingke/shell_test>cat file.txt
13643452377/01/0/0/000/000/000/66710/2011010/vc/8.400000/0.000000/0.000000/9.600000/0.000000/0.000000/1/1397/20110106234000/0/20110106231306/0/0/
13643452377/01/0/0/000/000/000/66710/2011010/vc/8.400000/0.000000/0.000000/9.600000/0.000000/0.000000/1/1397/20110106234000/0/20110106231306/0/0/
13643452377/01/0/0/000/000/000/66710/2011010/vc/8.400000/0.000000/0.000000/9.600000/0.00

上一页第3页

热门文档

相关文档

  • shell脚本学习笔记总结

    shell脚本学习笔记总结_互联网_IT/计算机_专业资料。最新版的shell脚本学习笔记,对嵌入式Linux的学习很有帮助Shell 脚本编程学习笔记 2013 年 5 月 2 日 追风~...

  • Shell脚本测试总结

    Shell脚本测试总结_计算机软件及应用_IT/计算机_专业资料。Shell脚本测试总结1. 脚本测试的苦难因为脚本使用的自由度很大,对于程序员限制很少,功能实现的随意性给...

  • LINUX Shell脚本介绍总结

    LINUX Shell脚本介绍总结_计算机软件及应用_IT/计算机_专业资料。LINUX Shell脚本介绍总结Shell脚本介绍 Shell脚本介绍 脚本语言是不需要事先编译,在执行时才直 接...

  • LINUX_Shell脚本介绍总结

    输入文字 Last Line Mode 主要功能:搜索或替换、存保存及结束 按q、pi、wq键 回到提示符 Shell脚本介绍创建shell脚本 指定以bash shell执行此文件 在vi输入下列...

  • Shell脚本介绍总结

    shell脚本介绍总结shell脚本介绍总结隐藏>> Shell脚本介绍 ? 脚本语言是不需要事先编译,在执行时才直 接解释每一行程序的语言。 ? 具有接受命令行参数、用户输入...

  • Shell脚本 编写总结

    Shell 脚本 编写总结 1. 文本操作 1) 获得文件所有字符内容 sed ‘np’ /path/filename (n 表示任意行号) cat /path/filename awk ‘{print}’ /path/...

  • 自己总结的shell脚本学习笔记(未完待续)

    自己总结的shell脚本学习笔记(未完待续)_互联网_IT/计算机_专业资料。关于shell脚本编程 比较全的资料 自己总结的Shell 脚本编程学习笔记 2013 年 4 月 27 日 ...

  • 常用shell脚本命令总结

    常用shell脚本命令总结_计算机软件及应用_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档常用shell脚本命令总结_计算机软件及应用_IT/计算机_专业资料。10...

  • 常用shell脚本命令总结

    常用shell脚本命令总结常用shell脚本命令总结隐藏>> 1,显 示包含文字 aaa 的下一行的内容: sed -n '/aaa/{n;p;}' filename 2,删 除当前行与下一行的...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email