src_dir=$(pwd)/All_h
dst_dir=$(pwd)/All
diff_dir=$(pwd)/diff if [ ! -d $diff_dir ]
then
mkdir $diff_dir
fi for src_full_entry in $src_dir/*
do
src_cat_entry=$(echo $src_full_entry | sed -e "s/\.[0-9a-rA-F]\{8\}$//")
src_cat_entry=$(basename "$src_cat_entry")
src_ivr_log="$src_full_entry/de_ivr.log"
if [ -f "$src_ivr_log" ]
then
#echo "$src_cat_entry"
dst_ivr_log=$(find $dst_dir -regextype posix-egrep -regex ".*/$src_cat_entry\.[0-9A-Fa-f]{8}/ivr.log$")
#echo $dst_ivr_log
if [ -f "$dst_ivr_log" ]
then
diff_ivr_log="$diff_dir/$src_cat_entry.diff"
summary="$diff_dir/$src_cat_entry""_summary.txt"
#echo $diff_ivr_log
#diff -u "$src_ivr_log" "$dst_ivr_log" > "$diff_ivr_log" echo "" > "$summary" echo "##########################################################" >> "$summary"
echo "$src_ivr_log:" >> "$summary"
echo "##########################################################" >> "$summary"
grep -i -n -A 20 "$src_cat_entry" "$src_ivr_log" >> "$summary" echo "" >> "$summary"
echo "##########################################################" >> "$summary"
echo "" >> "$summary" echo "##########################################################" >> "$summary"
echo "$dst_ivr_log:" >> "$summary"
echo "##########################################################" >> "$summary"
grep -i -n -A 20 "$src_cat_entry" "$dst_ivr_log" >> "$summary"
#diff -u "$src_ivr_log" "$dst_ivr_log"
fi
fi
done

  

if we want to use regular expressions for find command, we can do it like this.

find $dst_dir -regextype posix-egrep -regex ".*/$src_cat_entry\.[0-9A-Fa-f]{8}/ivr.log$"

  

extract specified contents from two files.的更多相关文章

  1. How to extract msu/msp/msi/exe files from the command line

    http://www.windowswiki.info/2009/02/19/how-to-extract-msumspmsiexe-files-from-the-command-line/ Micr ...

  2. Using command-line Subversion to access project source files

    Help index About source code version control with Software Configuration Management (Subversion) Usi ...

  3. Reading Text-based Files In ASP.NET

    Friday, July 17, 2015 1:43 PM Every time I need to work with the contents of text-based files in an ...

  4. Gradle Goodness: Copy Files with Filtering

    Gradle Goodness: Copy Files with Filtering Gradle's copy task is very powerful and includes filterin ...

  5. Automated Memory Analysis

    catalogue . 静态分析.动态分析.内存镜像分析对比 . Memory Analysis Approach . volatility: An advanced memory forensics ...

  6. Python之路第一课Day5--随堂笔记(模块)

    本节课程大纲: 1.模块介绍 2.time &datetime模块 3.random 4.os 5.sys 6.shutil 7.json & picle 8.shelve 9.xml ...

  7. python 常用模块之os、sys、shutil

    目录: 1.os 2.sys 3.shutil 一.os模块 说明:os模块是对操作系统进行调用的接口 os.getcwd() #获取当前工作目录,即当前python脚本工作的目录路径 os.chdi ...

  8. python模块(六)

    模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...

  9. Basic linux command-with detailed sample

    Here I will list some parameters which people use very ofen, I will attach the output of the command ...

随机推荐

  1. 《JavaScript DOM 编程艺术》学习成果

    (在线演示地址)[http://thqy39.github.io/works/03.Js%20DOM%20website/index.html]

  2. s11 day106-107 RBAC模块

    一.登录 把权限存在session中 1. rbac models from django.db import models class Permission(models.Model): " ...

  3. 更新python的依赖包,亲测!

    输入pip install --upgrade pandas 无需卸载,让它自己更新就好 pandas可以改成别的包

  4. JNDI数据源的配置及使用

    数据源的作用JDBC操作的步骤:  1. 加载驱动程序  2. 连接数据库  3. 操作数据库  4. 关闭数据库,释放连接 也就是说,所有的用户都需要经过此四步进行操作,但是这四步之中有三步对所有人 ...

  5. ID和Phone高压缩比存储和查询

    ID和Phone高压缩比存储和查询的简单例子, 无多线程处理 运行环境JDK8+maven 0. 模块分割 1. 基本思路 源文件BCP每一行都转为一个全局的RowID,可以直接映射到FileName ...

  6. go 学习之字符串

    字符串 字符串是不可变值类型,内部⽤用指针指向 UTF-8 字节数组.默认值是空字符串 "".用索引号访问某字节,如 s[i], i不能是负数.不能⽤用序号获取字节元素指针,&am ...

  7. element UI的使用

    npm install --save element-ui main.js里面添加 import ElementUI from 'element-ui' import 'element-ui/lib/ ...

  8. Mysql 事务相关

    MySQL介绍 什么是MySQL? ​ MySQL 是一种关系型数据库,在Java企业级开发中非常常用,因为 MySQL 是开源免费的,并且方便扩展.阿里巴巴数据库系统也大量用到了 MySQL,因此它 ...

  9. Android 混淆总结(直接copy)(转)

    转自:http://blog.csdn.net/u012188405/article/details/51985273 # Add project specific ProGuard rules he ...

  10. 二、sqlyog的使用

    1. 创建数据库. 注意字符集 2.创建表 注意 表名.引擎名.字符集