xargsは前のコマンドの引数をすべて渡すコマンド。
Link
http://qiita.com/amasok23/items/5773cc3460c31163052f
http://kawatama.net/web/1141
https://hydrocul.github.io/wiki/commands/xargs.html
[root@cent2 ~]# find ./hoge* -type f -print | xargs grep 'filter'
./hoge10.txt: <Criteria fieldName="name" filterString="an@123.com" match="equals"/>
./hoge11.txt: <Criteria fieldName="status" filterString="Known" match="equals"/>
./hoge13.txt: <Criteria fieldName="status" filterString="Known" match="equals"/>
./hoge3-3.txt: <Criteria fieldName="name" filterString="mike" match="equals"/>
[root@cent2 ~]# find ./hoge* -type f -print | xargs grep 'Filter'
./hoge10.txt:<Filter entity="GuestUser">
./hoge10.txt:</Filter>
./hoge11.txt:<Filter entity="Endpoint">
./hoge11.txt:</Filter>
./hoge13.txt:<Filter entity="Endpoint">
./hoge13.txt:</Filter>
./hoge3-3.txt:<Filter entity="GuestUser">
./hoge3-3.txt:</Filter>
[root@cent2 ~]# find ./ -name *python*
./python
~ # find / -name *ftp* | xargs ls -al
-rwxr-xr-x 1 root root 663 Jan 1 2000 /aruba/bin/ftp_image
-rwxr-xr-x 1 root root 170400 Jan 1 2000 /aruba/bin/ncftpget
-rwxr-xr-x 1 root root 623 Jan 1 2000 /aruba/bin/retftpcore
-rwxr-xr-x 1 root root 16096 Jan 1 2000 /aruba/bin/sap-tftp
-rwxr-xr-x 1 root root 930 Jan 1 2000 /aruba/bin/tftp-panic
-rwxr-xr-x 1 root root 968 Jan 1 2000 /aruba/bin/tftp_put
-rwxr-xr-x 1 root root 1898 Jan 1 2000 /aruba/bin/tftpcore
-rwxr-xr-x 106 root root 608720 Jan 1 2000 /usr/bin/ftpget
-rwxr-xr-x 106 root root 608720 Jan 1 2000 /usr/bin/ftpput
-rwxr-xr-x 106 root root 608720 Jan 1 2000 /usr/bin/tftp
[root@cent2 ~]# find --help
Usage: find [path...] [expression]
default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:
operators (decreasing precedence; -and is implicit where no others are given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
positional options (always true): -daystart -follow -regextype
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
-context CONTEXT
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
-exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
-execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
Comments
Post a Comment