Skip to main content

Command: find


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

Popular posts from this blog

SNMP mib file installation

Step1: Installing private MIB file and changing SNMP configuration on PC Refeering to the following link for private mibs: http://changineer.info/server/monitoring/monitoring_snmp.html http://wiki.pomme-tech.com/index.cgi?page=%A5%D7%A5%E9%A5%A4%A5%D9%A1%BC%A5%C8MIB%A4%CE%C4%C9%B2%C3&print=1 http://www.lesstep.jp/step_on_board/linux/23/ Refeering to the following link for errors related to mibs: http://www.zabbix.jp/node/3056 http://serverfault.com/questions/440319/did-not-find-zerodotzero-in-module-snmpv2-smi Step2. installing private mib files in an appropriate directory(/usr/share/snmp/private-bims) Step3. changing snmp.conf files. You may need to create an empty new file NOT snmpd.conf. ---------------------------------------- /etc/snmp/snmp.conf MIBDIRS /usr/share/snmp/mibs:/usr/share/snmp/private-bims MIBS all ---------------------------------------- Step4: Checking the output before and after installing private mib files. You don't need to restart th

SNMP mib tips: snmpwalk & snmptranslate

Referring to this web site: https://gist.github.com/bahootyper/575190 The following explanations are about snmpwalk & snmptranslate command options. #Displayes every OID $ snmptranslate -Tp #Dispaly OID label(MIB name) from OID $ snmptranslate .1.3.6.1.4.1.14823.2.2.1.1.2.1.1.2 WLSX-SWITCH-MIB::userPhyAddress #Dispaly MIB tree name from OID label #-IR: label,  -Tp: tree option $ snmptranslate -IR -Tp nUser6Name +-- -R-- String    nUser6Name(3)          Textual Convention: DisplayString          Size: 0..128 #Dispaly MIB tree name from OID label #-IR: label,  -Tp: tree option $ snmptranslate -Tp .1.3.6.1.4.1.14823.2.2.1.14.1.2.1.3 +-- -R-- String    nUser6Name(3)          Textual Convention: DisplayString          Size: 0..128 # OID's detailed option $ snmptranslate -Td .1.3.6.1.4.1.14823.2.2.1.14.1.2.1.3 WLSX-USER6-MIB::nUser6Name nUser6Name OBJECT-TYPE   -- FROM WLSX-USER6-MIB   -- TEXTUAL CONVENTION DisplayString   SYNTAX OCTET STRING (0..1

ettercap on MAC OSX

TK-MBA-2:~ taka$ brew info ettercap ettercap: stable 0.8.2 (bottled), HEAD Multipurpose sniffer/interceptor/logger for switched LAN https://ettercap.github.io/ettercap/ /usr/local/Cellar/ettercap/0.8.2_1 (75 files, 2.3MB) *   Poured from bottle on 2017-05-25 at 14:14:48 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ettercap.rb ==> Dependencies Build: cmake ✘ , ghostscript ✘ Required: pcre ✔ , libnet ✔ , openssl ✔ Optional: ghostscript ✘ , gtk+ ✘ , gtk+3 ✘ , luajit ✘ ==> Options --with-ghostscript Build with ghostscript support --with-gtk+ Build with gtk+ support --with-gtk+3 Build with gtk+3 support --with-luajit Build with luajit support --without-curses Install without curses interface --without-ipv6 Install without IPv6 support --without-plugins Install without plugins support --HEAD Install HEAD version TK-MBA-2:~ taka$ ettercap --with-gtk+ ettercap 0.8.2 copyright 2001-2015 Ettercap