-
Notifications
You must be signed in to change notification settings - Fork 2
/
find_command
22 lines (13 loc) · 1.07 KB
/
find_command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
find /hadoopfs/ -name application_1598993606687_7237 -exec du -sh {} \;
find /hadoopfs/ -name application_1604581765217_0296 -exec du -sh {} \;|sort -rh
find /home/hary/workarea/bind_test_multi -type f | wc -l
find /var/run/cloudera-scm-agent/process/ -not -empty -ls 2>/dev/null| awk '$0 ~ /solr-SOLR/ && /solr.keytab/ {print $NF}' - get the full path of a file
full ouput of find command is fed to awk command using $0
~ is used search in output for the lines conatining /solr-SOLR/
&& is used to further search the output containing /solr.keytab/ in the output containing /solr-SOLR/
final output - /var/run/cloudera-scm-agent/process/*********-solr-SOLR_SERVER/solr.keytab
there can also be output like
/var/run/cloudera-scm-agent/process/*********1-solr-SOLR_SERVER/solr.keytab
/var/run/cloudera-scm-agent/process/*********2-solr-SOLR_SERVER/solr.keytab
/var/run/cloudera-scm-agent/process/*********3-solr-SOLR_SERVER/solr.keytab
In this case use find /var/run/cloudera-scm-agent/process/ -not -empty -ls 2>/dev/null| awk '$0 ~ /solr-SOLR/ && /solr.keytab/ {print $NF}' |head -n 1