Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unix Bash AIX-从一个目录中查找文件,但不在另一个目录中查找_Bash_Shell_Unix_Csv_Bin - Fatal编程技术网

Unix Bash AIX-从一个目录中查找文件,但不在另一个目录中查找

Unix Bash AIX-从一个目录中查找文件,但不在另一个目录中查找,bash,shell,unix,csv,bin,Bash,Shell,Unix,Csv,Bin,到目前为止,我有以下命令,只是在下一点上有点卡住了 comm -23 <( find /dir1/report_dir2/dir3/2013* -name *\*MyFile* -exec basename {} \; | sort | uniq ) <( find /dir0/dir1/dir2/loadedreports/archive* -name *\*MyFile* -exec basename {} \; | sort | uniq ) > /home/Ben10/

到目前为止,我有以下命令,只是在下一点上有点卡住了

comm -23 <( find /dir1/report_dir2/dir3/2013* -name *\*MyFile* -exec basename {} \; | sort | uniq ) <( find /dir0/dir1/dir2/loadedreports/archive* -name *\*MyFile* -exec basename {} \; | sort | uniq ) > /home/Ben10/list.txt
comm-23尝试以下操作

comm -23 <( find /dir1/report_dir2/dir3/2013* -name '*MyFile*' | perl -pe 's/.*(MyFile[^.]*\.csv)(\.gz)?$/$1/' | sort -u ) <( find /dir0/dir1/dir2/loadedreports/archive* -name '*MyFile*' | perl -pe 's/.*(MyFile[^.]*\.csv)$/$1/' | sort -u ) > /home/Ben10/list.txt

我把长长的陈述分成几部分,每一部分都做得很好,结果和你的一样出色,非常感谢。
find /dir1/report_dir2/dir3/2013* -name '*MyFile*' | perl -pe 's/.*(MyFile[^.]*\.csv)(\.gz)?$/$1/' | sort -u > /home/Ben10/di1_list.txt

find /dir0/dir1/dir2/loadedreports/archive* -name '*MyFile*' | perl -pe 's/.*(MyFile[^.]*\.csv)$/$1/' | sort -u > /home/Ben10/di2_list.txt

comm -23 /home/Ben10/di1_list.txt /home/Ben10/di2_list.txt > /home/Ben10/list.txt

rm /home/Ben10/di1_list.txt /home/Ben10/di2_list.txt