- 浏览: 2188711 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (682)
- 软件思想 (7)
- Lucene(修真篇) (17)
- Lucene(仙界篇) (20)
- Lucene(神界篇) (11)
- Solr (48)
- Hadoop (77)
- Spark (38)
- Hbase (26)
- Hive (19)
- Pig (25)
- ELK (64)
- Zookeeper (12)
- JAVA (119)
- Linux (59)
- 多线程 (8)
- Nutch (5)
- JAVA EE (21)
- Oracle (7)
- Python (32)
- Xml (5)
- Gson (1)
- Cygwin (1)
- JavaScript (4)
- MySQL (9)
- Lucene/Solr(转) (5)
- 缓存 (2)
- Github/Git (1)
- 开源爬虫 (1)
- Hadoop运维 (7)
- shell命令 (9)
- 生活感悟 (42)
- shell编程 (23)
- Scala (11)
- MongoDB (3)
- docker (2)
- Nodejs (3)
- Neo4j (5)
- storm (3)
- opencv (1)
最新评论
-
qindongliang1922:
粟谷_sugu 写道不太理解“分词字段存储docvalue是没 ...
浅谈Lucene中的DocValues -
粟谷_sugu:
不太理解“分词字段存储docvalue是没有意义的”,这句话, ...
浅谈Lucene中的DocValues -
yin_bp:
高性能elasticsearch ORM开发库使用文档http ...
为什么说Elasticsearch搜索是近实时的? -
hackWang:
请问博主,有用solr做电商的搜索项目?
Solr中Group和Facet的用法 -
章司nana:
遇到的问题同楼上 为什么会返回null
Lucene4.3开发之第八步之渡劫初期(八)
find命令,是个非常nice的命令,如果你还不了解这个命令,可以使用man find命令,来查看具体的介绍,find命令结合grep命令之后是非常强大的:
(1)找出某个目录下所有的文件,并且是csv结尾的:
[search@dnode1 2015-04-10]$ find ./conversions/ -type f | grep "csv$" ./conversions/pv/tmp_search_date_cate_pv/tmp_search_date_cate_pv.csv ./conversions/pv/tmp_search_date_algo_channel_pv/tmp_search_date_algo_channel_pv.csv ./conversions/pv/tmp_search_date_pv/tmp_search_date_pv.csv ./conversions/pv/tmp_search_date_algo_pv/tmp_search_date_algo_pv.csv ./conversions/pv/tmp_search_date_algo_country_pv/tmp_search_date_algo_country_pv.csv ./conversions/pv/tmp_search_date_algo_cate_pv/tmp_search_date_algo_cate_pv.csv [search@dnode1 2015-04-10]$
(2)同理找出以0结尾的文件:
[search@dnode1 2015-04-10]$ find ./conversions/ -type f | grep "0$" ./conversions/uv/tmp_search_date_algo_uv/000000_0 ./conversions/uv/tmp_search_date_algo_channel_uv/000000_0 ./conversions/uv/tmp_search_date_cate_uv/000000_0 ./conversions/uv/tmp_search_date_algo_country_uv/000000_0 ./conversions/uv/tmp_search_date_country_uv/000000_0 ./conversions/uv/tmp_search_date_channel_uv/000000_0 ./conversions/uv/tmp_search_date_uv/000000_0 ./conversions/uv/tmp_search_date_algo_cate_uv/000000_0 ./conversions/keyword/tmp_search_kw_algo_rate/000000_0 ./conversions/keyword/tmp_search_kw_rate/000000_0 ./conversions/pv/tmp_search_date_cate_pv/000000_0 ./conversions/pv/tmp_search_date_algo_channel_pv/000000_0 ./conversions/pv/tmp_search_date_pv/000000_0 ./conversions/pv/tmp_search_date_algo_pv/000000_0 ./conversions/pv/tmp_search_date_algo_country_pv/000000_0 ./conversions/pv/tmp_search_date_channel_pv/000000_0 ./conversions/pv/tmp_search_date_algo_cate_pv/000000_0 ./conversions/pv/tmp_search_date_country_pv/000000_0 [search@dnode1 2015-04-10]$
(3)查看所有的目录:
[search@dnode1 2015-04-10]$ find ./conversions/ -type d ./conversions/ ./conversions/uv ./conversions/uv/tmp_search_date_algo_uv ./conversions/uv/tmp_search_date_algo_channel_uv ./conversions/uv/tmp_search_date_cate_uv ./conversions/uv/tmp_search_date_algo_country_uv ./conversions/uv/tmp_search_date_country_uv ./conversions/uv/tmp_search_date_channel_uv ./conversions/uv/tmp_search_date_uv ./conversions/uv/tmp_search_date_algo_cate_uv ./conversions/keyword ./conversions/keyword/tmp_search_kw_algo_rate ./conversions/keyword/tmp_search_kw_rate ./conversions/pv ./conversions/pv/tmp_search_date_cate_pv ./conversions/pv/tmp_search_date_algo_channel_pv ./conversions/pv/tmp_search_date_pv ./conversions/pv/tmp_search_date_algo_pv ./conversions/pv/tmp_search_date_algo_country_pv ./conversions/pv/tmp_search_date_channel_pv ./conversions/pv/tmp_search_date_algo_cate_pv ./conversions/pv/tmp_search_date_country_pv [search@dnode1 2015-04-10]$
find命令的说明:
[search@dnode1 2015-04-10]$ man find FIND(1) FIND(1) NAME find - search for files in a directory hierarchy SYNOPSIS find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression] DESCRIPTION This manual page documents the GNU version of find. GNU find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name. If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the "Security Considerations" chapter of the findutils documentation, which is called Finding Files and comes with findutils. That document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of information. OPTIONS The -H, -L and -P options control the treatment of symbolic links. Command-line arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins with ‘-’, or the argument ‘(’ or ‘!’. That argument and any following arguments are taken to be the expression describing what is to be searched for. If no paths are given, the current directory is used. If no expression is given, the expression -print is used (but you should probably consider using -print0 instead, anyway). This manual page talks about ‘options’ within the expression list. These options control the behaviour of find but are specified immediately after the last path name. The five ‘real’ options -H, -L, -P, -D and -O must appear before the first path name, if at all. A double dash -- can also be used to signal that any remaining argu- ments are not options (though ensuring that all start points begin with either ‘./’ or ‘/’ is generally safer if you use wildcards in the list of start points). -P Never follow symbolic links. This is the default behaviour. When find examines or prints information a file, and the file is a symbolic link, the information used shall be taken from the properties of the symbolic link itself. -L Follow symbolic links. When find examines or prints information about files, the information used shall be taken from the properties of the file to which the link points, not from the link itself (unless it is a broken symbolic link or find is unable to examine the file to which the link points). Use of this option implies -noleaf. If you later use the -P option, -noleaf will still be in effect. If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched. When the -L option is in effect, the -type predicate will always match against the type of the file that a symbolic link points to rather than the link itself (unless the symbolic link is broken). Using -L causes the -lname and -ilname predicates always to return false. -H Do not follow symbolic links, except while processing the command line arguments. When find examines or prints information about files, the information used shall be taken from the properties of the symbolic link itself. The only exception to this behaviour is when a file specified on the command line is a symbolic link, and the link can be resolved. For that situation, the information used is taken from whatever the link points to (that is, the link is followed). The information about the link itself is used as a fallback if the file pointed to by the symbolic link cannot be examined. If -H is in effect and one of the paths specified on the command line is a symbolic link to a directory, the contents of that directory will be examined (though of course -maxdepth 0 would prevent this). If more than one of -H, -L and -P is specified, each overrides the others; the last one appearing on the command line takes effect. Since it is the default, the -P option should be considered to be in effect unless either -H or -L is specified. GNU find frequently stats files during the processing of the command line itself, before any searching has begun. These options also affect how those arguments are pro- cessed. Specifically, there are a number of tests that compare files listed on the command line against a file we are currently considering. In each case, the file specified on the command line will have been examined and some of its properties will have been saved. If the named file is in fact a symbolic link, and the -P option is in effect (or if neither -H nor -L were specified), the information used for the comparison will be taken from the properties of the symbolic link. Otherwise, it will be taken from the properties of the file the link points to. If find cannot follow the link (for example because it has insufficient privileges or the link points to a nonexistent file) the properties of the link itself will be used. :
发表评论
-
什么是操作系统的虚拟内存?
2019-07-17 10:04 787https://mp.weixin.qq.com/s?__bi ... -
关于Linux进程的基础知识
2018-12-17 15:58 1299### 前言 在计算机里面,一个进程通常指的是一个运行程序的 ... -
小知识之Linux系统中的最大进程数,最大文件描述,最大线程数
2018-01-19 22:16 2035今天来了解一下linux里面的一些小知识: (一)Lin ... -
Nginx配置的一些小功能
2018-01-12 21:28 1531前面的文章,已经介绍 ... -
理解正常代理与反向代理的区别
2017-12-21 09:57 688http://blog.csdn.net/u010454030 ... -
Nginx入门介绍与安装
2017-12-20 21:38 1289### Nginx是什么? Nginx ... -
给centos重新安装yum的base-repo源
2017-12-14 21:06 6239如果自己的centos的系统yum源出现问题了,如何才能修 ... -
如何在centos7上使用shadowsocks配置代理
2016-11-16 16:59 17466作为一名程序员,如 ... -
centos7安装mysql
2016-11-14 16:41 1294centos7的默认yum源已经 ... -
unbutu+mysql的root密码重置方法
2016-01-11 14:16 1267MySQL密码重置策略: 1,停止mysql服务 s ... -
诡异的SSH免密失效
2015-12-31 12:31 2821今天在开发环境,重启了下hadoop,发现log里面竟然打出 ... -
Linux远程ssh脚本执行命令问题
2015-12-04 13:20 3824总结下使用ssh远程执行命令需要注意点: 一般我们会使用s ... -
Linux网络神器之强大的NetCat命令
2015-10-15 21:40 6485名称:netcat命令在linux中别名为nc 作用:支持任意 ... -
vi使用技巧--批量加注释任意符号
2015-08-07 16:25 1327使用vi批量加注释“#”或者是// 等一些符号,看似简单但用处 ... -
使用shell分页读取600万+的MySQL数据脚本
2015-07-15 13:02 2736shell-mysql (1)脚本背景: 由于要在Linux ... -
解决Centos下vim粘贴内容格式混乱问题
2015-06-24 13:36 3535有时候,我们在向vim打开的一个xml,或者任意文件中,拷贝 ... -
如何在Centos下设置Vim的永久显示行号功能?
2015-03-19 17:32 2066在Linux系统中,我们经常会使用vi或vim命令,来操作文本 ... -
你有一个好的归档习惯吗?
2015-02-11 22:01 1895备忘和扯一扯最近散仙 ... -
centos6.5服务器时间同步
2014-10-30 18:54 1388实际的开发环境中,我们的一组服务器的时间都需要一致,这样在执行 ... -
Cenots6更换163yum源
2014-10-09 10:52 1238如果发现自己的centos的yum源,速度缓慢,或出现异常不能 ...
相关推荐
### Linux 下为目录和文件设置权限,包括子目录的循环递归设置 #### 知识点一:Linux 文件权限概述 在 Linux 操作系统中,文件权限管理是至关重要的安全特性之一。通过权限管理,我们可以控制不同用户对文件或目录...
本代码是linux下递归输出指定路径下文件夹和文件内容的,已测试通过,有需要的自己下载!
下面是一个简单的`tree.c`程序示例,它会打印出当前目录及其所有子目录下的文件和子目录: ```c #include #include void print_tree(char* dir_path, int level) { DIR* dir = opendir(dir_path); if (dir != ...
`du`的一个关键特性是它可以递归地计算目录中所有文件的大小,这对于定位哪个文件或目录占用大量空间非常有用。例如,`du -h work/testing/*`将显示`work/testing`目录下每个子目录或文件的大小。如果要深入到`logs`...
`-r` 选项表示递归下载目录下的所有文件。 四、FTP 多文件下载和上传的 Shell 脚本 以下是一个使用 Shell 脚本实现 FTP 多文件下载和上传的示例: ``` #!/bin/bash # 设置 FTP 服务器的 IP 地址和端口号 FTP_...
演示了在Linux下利用C语言递归遍历指定目录下的子目录(不含隐藏目录)和文件。只要掌握了这种方法,你也可以修改成你需要的功能。
今天要用md5sum操作目录,递归生成目录下所有文件的md5值,结果发现它不支持递归操作于是写了个php脚本处理下 代码: <?php $path ='/data/www/bbs/source'; $outfile = 'file.md5'; get_file_md5($path, ...
Linux采用了层次化的文件系统结构,所有文件和目录都从根目录`/`开始。以下是一些常见的目录及其作用: - **/bin**:存放用户级别的二进制可执行文件。 - **/boot**:存放与启动相关的文件,如内核映像。 - **/dev*...
本话题将详细讲解如何利用递归算法在指定目录及其子目录下查找大小为2KB的文件,同时也会涉及到一些相关的编程技术和资源。 首先,递归算法是指一个函数或过程在其定义中调用自身来解决问题的方法。在查找文件的...
它的主要任务是在给定的路径下逐级遍历所有文件和子目录,并对每个文件或目录调用用户提供的回调函数。`ftw()`函数的原型如下: ```c int ftw(const char *path, int (*fn)(const char *, const struct stat *, int...
在日常工作中,我们经常会用到各种Linux命令来管理文件、目录以及进行其他系统操作。本文将详细介绍一系列重要的Linux命令及其用法,帮助读者更好地掌握这些工具。 #### 1. 文件和目录的基本操作 - **创建文件**:...
- `-R`:递归地改变目录下所有文件和子目录的权限。 - `-c`:如果权限确实发生了改变,则显示相应的信息。 - `-f`:即使发生错误也不显示任何信息。 - `-v`:显示详细的操作信息。 ##### 权限模式设置: 权限模式...
Linux下的目录文件操作主要涉及到创建、移动、重命名、复制以及删除等几个方面,这些操作都是通过Linux命令行进行的。 首先,创建目录是管理文件系统的基本操作之一,用来新建一个或多个目录。在Linux中可以使用...
本示例着重讨论如何使用C++在Linux和Windows操作系统中读取指定路径下的文件和目录列表。这两个主要的操作系统有着不同的文件系统结构和API接口,因此,实现这个功能需要对它们各自的特性和API有深入的理解。 在...
运行程序后,它将在指定目录下查找所有文件,并将结果写入名为 `file_list.txt` 的文本文件。 这个程序提供了一个基础框架,你可以根据需要进行扩展,例如添加错误处理、支持递归遍历子目录,或者改变输出格式。...
当我们要复制一个目录及其所有子目录时,递归方法会遍历目录树的每一层,逐个复制每个子目录及其包含的文件。 实现这个功能的方法因操作系统而异。在Windows系统中,可以使用命令行工具`xcopy`或`robocopy`,在...
使用`cp`命令复制时,`-r`选项用于递归复制目录及其子目录中的文件,而`-a`选项则确保新复制的文件与原文件在所有属性上保持一致。 - rm:删除文件或目录。`rm -rf`命令会强制递归删除指定的文件或目录,不会提示...
在linux系统中我们可以使用ls Z*_2014*来查找相应的匹配文件,本程序使用c语言通过递归调用,实现了这个功能。
- `rm -r directory`:递归删除目录及其内容,如果有子目录或文件,会提示确认。 - `rm -rf directory`:强制递归删除目录及其内容,不提示确认,非常危险,需谨慎使用。 关于用户管理,这里提到了几个命令: - `su...