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