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. Powercli随笔 - PowerCLI script to sequentially Storage vMotion VMs from a CSV File

    PowerCLI script to sequentially Storage vMotion VMs from a CSV File This is a PowerCLI script that I ...

  2. R语言利用ROCR评测模型的预测能力

    R语言利用ROCR评测模型的预测能力 说明 受试者工作特征曲线(ROC),这是一种常用的二元分类系统性能展示图形,在曲线上分别标注了不同切点的真正率与假正率.我们通常会基于ROC曲线计算处于曲线下方的 ...

  3. SSL证书部署HTTPS站点Apache/Nginx配置

    SSL证书及HTTPS协议 SSL 证书是一种数字证书,它使用 Secure Socket Layer 协议在浏览器和 Web 服务器之间建立一条安全通道,从而实现:1.数据信息在客户端和服务器之间的 ...

  4. java 重新学习 (七)

    一.mysql的InnoDB通过建立行级索确保事务完整性.,并以Oracle风格的共享锁来处理select语句.系统默认存储为InnoDB. 二. -- mysql 创建表 CREATE TABLE ...

  5. Cocos2d-x之String

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. 在Cocos2d-x中能够使用的字符串constchar*.std::string和cocos2d::__String等,其中const ...

  6. 搭建干净的Mac开发学习环境

    docker + linux + gcc/g++ https://www.jianshu.com/p/d113db99fe24 https://www.jianshu.com/p/d26140d20c ...

  7. C++中的面向对象(二)

    1,类之间的基本关系: 1,继承: 1,从已存在类细分出来的类和原类之间具有继承关系(is-a): 1,子类就是一个(is-a)父类: 2,继承是单向的: 2,继承的类(子类)拥有原类(父类)的所有属 ...

  8. HDU2732 Leapin' Lizards

    Leapin' Lizards Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  9. 60.Median of Two Sorted Arrays(两个排序数组的中位数)

    Level:   Hard 题目描述: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find t ...

  10. SqlServer 查询所有字段要写说明

    查询出所有未写说明的字段: SELECT IC.table_name TableName, ColName=C.name, PFD.[value] FROM sys.columns C INNER J ...