Linux find inversion finds results that are not found

Source: Internet
Author: User

Under Linux, sometimes you need to find some files, there are times these file formats are not uniform and specification, but the files that need to be excluded are uniform format, you can use the reverse function of the Find command

The general command to find files with find is:

Find. -name "*.tar.*"-o-name "*.patch"

This means finding files with the. Tar. character Or.patch characters in the file name.

Now to exclude these files, think Grep/ack/ag have a function called-revert, is to find the content is not the target string, find no, but it provides a more powerful! Non-command.

Find. \ (\!-name "*.tar.*" \)

In this sentence () is the meaning of the expression (expr) used, and then one of them! The result can be reversed.

Find. \ (\! \ (-name "*.tar.*"-o-name "*.patch" \) \)

This is the same thing, but when you use the-o command, you need to add a second layer of parentheses.

Linux find inversion finds results that are not found

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.