NAME
select - Greple module to select files
SYNOPSIS
greple -Mdig -Mselect ... --dig .
FILENAME
--suffix file suffixes
--select-name regex match for file name
--select-path regex match for file path
--x-suffix Unselect version of --suffix
--x-select-name Unselect version of --select-name
--x-select-path Unselect version of --select-path
DATA
--shebang included in #! line
--select-data regex match for file data
--x-shebang Unselect version of --shebang
--x-select-data Unselect version of --select-data
DESCRIPTION
Greple's -Mselect module allows to filter files using their name and content data. It is usually supposed to be used along with -Mfind or -Mdig module.
For example, next command scan files end with .pl
and .pm
under current directory.
greple -Mdig -Mselect --suffix=pl,pm foobar --dig .
This is almost equivalent to the next command using --dig option with condition expression for find command.
greple -Mdig foobar --dig . ( -name *.pl -o -name *.pm )
The problems is that above command does not search perl script without suffixes. Next command can search both looking at shebang line.
greple -Mdig -Mselect --suffix=pl,pm --shebang perl foobar --dig .
Generic option --select-name, --select-path and --select-data take regular expression and works for arbitrary use.
OPTIONS
FILENAME
- --suffix=xx,yy,zz ...
-
Specify one or more file name suffixes connecting by comma (
,
). They will be converted to/\.(xx|yy|zz)$/
expression and compared to the file name. - --select-name=regex
-
Specify regular expression and it is compared to the file name. Next command search Makefiles under any directory.
greple -Mselect --select-name '^Makefile.*'
- --select-path=regex
-
Specify regular expression and it is compared to the file path.
- --x-suffix=xx,yy,zz ...
- --x-select-name=regex
- --x-select-path=regex
-
These are reverse version of corresponding options. File is not selected when matched.
DATA
- --shebang=aa,bb,cc
-
This option test if a given string is included in the first line of the file start with
#!
(aka shebang) mark. Multiple names can be specified connecting by command (,
). Given string is converted to the next regular expression:/\A #! .*\b (aa|bb|cc)/x
- --select-data=regex
-
Specify regular expression and it is compared to the file content data.
- --x-shebang=aa,bb,cc
- --x-select-data=regex
-
These are reverse version of corresponding options. File is not selected when matched.