首页 > 代码库 > extract specified contents from two files.
extract specified contents from two files.
src_dir=$(pwd)/All_hdst_dir=$(pwd)/Alldiff_dir=$(pwd)/diffif [ ! -d $diff_dir ]then mkdir $diff_dirfifor 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 fidone
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$"
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。