我怎样才能结合查找命令? [英] How can I combine the Find-commands?

查看:125
本文介绍了我怎样才能结合查找命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题出现在我原来的问题这里。 a>



我试图用find命令找到两个find命令的输出之间的公共元素。

pre $ find $ find〜/ bin / FilesDvorak /.* -maxdepth 0` -and` find〜/ .PAST_RC_files /.*`


解决方案

像这样的工作,而不是重新发明轮子?

  diff -qrs〜/ bin / FilesDvorak /〜/ .PAST_RC_files / grep -P是相同的|不同的

你可以使用grep来获取文件只有在其中一个dirs等。

差异

$ ul

  • -q - -brief只输出文件是否有区别。
  • -r --recursive递归比较找到的所有子目录。
  • -s --report-identical-files报告两个文件相同。


    grep


    • -P:Perl风格的正则表达式。但是,如果没有它,也许可以做得很好,我通常会自动添加它。


    The question emerged my original question here.

    I try to find the common elements between the outputs of the two find-commands with a find-command. How can I get the command working?

    find `find ~/bin/FilesDvorak/.* -maxdepth 0` -and `find ~/.PAST_RC_files/.*`
    

    解决方案

    Would something like this work instead, rather than reinvent the wheel?

    diff -qrs ~/bin/FilesDvorak/ ~/.PAST_RC_files/ | grep -P "are identical|differ"
    

    You can play around with the grep to get the files present only in one of the dirs, etc.

    diff

    • -q --brief Output only whether files differ.
    • -r --recursive Recursively compare any subdirectories found.
    • -s --report-identical-files Report when two files are the same.

    grep

    • -P: Perl style regex. You can probably do away just fine without it though, I usually add it automatically.

    这篇关于我怎样才能结合查找命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆