In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use the Find command in linux to ignore one or more subdirectories. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
When you use the find command to find files on a linux system, you sometimes need to ignore certain directories, and you can use the-prune parameter to filter.
It must be noted, however, that the path parameter to be ignored must immediately follow the search path, otherwise it will not work.
For example: specify to search all files in the / home/zth directory, but ignore the path to / home/zth/astetc:
The code is as follows:
Find / home/zth-path "/ home/zth/astetc"-prune-o-type f-print
To search by file name is:
The code is as follows:
Find / home/zth-path "/ home/zth/astetc"-prune-o-type f-name "cdr_*.conf"-print
What if you want to ignore more than two paths?
The code is as follows:
Find / home/zth/ (- path "/ home/zth/astetc"-o-path "/ home/zth/etc" /)-prune-o-type f-print
Find / home/zth/ (- path "/ home/zth/astetc"-o-path "/ home/zth/etc" /)-prune-o-type f-name "cdr_*.conf"-print
Note: there are spaces before and after / (and /).
To find the contents of a file, the following statement can solve the problem of directories with spaces:
The code is as follows:
Find. /-name "mysql*"-print0 | xargs-0 grep "SELECT lead_id FROM vicidial_list where vendor_lead_code"
If the directory does not have spaces, you can do this:
The code is as follows:
Find. /-name "mysql*" | xargs grep "SELECT lead_id FROM vicidial_list where vendor_lead_code"
Through the above example, you should be able to master the find command to find files, ignore the relevant directory method.
Thank you for reading! On "how to use the Find command in linux to ignore one or more subdirectories" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.