本文共 1691 字,大约阅读时间需要 5 分钟。
1:遍历文件夹下面所有文件,并输出到path.path文件中 dir_or_file=$1"/"$element
echo $dir_or_file >> path.path
word="opencv_similar_result"
cat ./path.path | while read line
if [[ $line == *$word* ]]
cat $line | while read value
a=`echo $value | awk '{print $6}'` #将输出的值赋给某变量,这样就可以继续进行操作 echo $value >> result.txt
# Copyright (c) 2015 SHUMEI Inc. All Rights Reserved.
# Authors: Chuanfeng Liu <lsp@ishumei.com>
dirpath=$(cd `dirname $0`;pwd)
export LD_LIBRARY_PATH="$dirpath/ccgo/lib:$LD_LIBRARY_PATH"
echo "warning: need image path"
./imageHash --image_filename=$1
./hash_test ./相似图片/有缘网相似图片/$i/ ./相似图片/有缘网相似图片/$i/ opencv 7.68
Folder_A="./opencv_celue_si"
for file_a in ${Folder_A}/*
temp_file=`basename $file_a`
cat ./opencv_celue_si/$temp_file | awk '{print $4}' > ../aaa.txt
dir="./saveimage/$temp_file/"
cat ../aaa.txt | while read line
cp "${line}" ./saveimage/$temp_file/
6.循环执行bin文件命令
#!/bin/bash
for((i=1;i<=64;i++));
do
./hash_test ./相似图片汇总/相似图片汇总/$i/ ./相似图片汇总/相似图片汇总/$i/ opencv 7.68 #hash_test为二进制文件
done
7.提取两个文件中共同列的值
awk 'NR==FNR{S[$1]=$0;next}NR>FNR{print S[$1],$2,$3}' gpu porn > jiehe
两个具有同一列的文件合并 ps:gpu和porn分别为两个文件名,文件内容分别为:
执行结果为: