You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
837 B
Bash
44 lines
837 B
Bash
#!/usr/bin/env bash
|
|
# vim:ts=4:sts=4:sw=4:et
|
|
#
|
|
# Author: Hari Sekhon
|
|
# Date: 2019-11-27 16:09:34 +0000 (Wed, 27 Nov 2019)
|
|
#
|
|
# https://github.com/harisekhon/bash-tools
|
|
#
|
|
# License: see accompanying Hari Sekhon LICENSE file
|
|
#
|
|
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
|
|
#
|
|
# https://www.linkedin.com/in/harisekhon
|
|
#
|
|
|
|
set -euo pipefail
|
|
[ -n "${DEBUG:-}" ] && set -x
|
|
|
|
usage(){
|
|
cat <<EOF
|
|
Recurses HDFS path arguments outputting:
|
|
|
|
<disk_space_for_all_replicas> <filename>
|
|
|
|
Calls HDFS command which is assumed to be in \$PATH
|
|
|
|
Make sure to kinit before running this if using a production Kerberized cluster
|
|
|
|
|
|
usage: ${0##*/} <file_or_directory_paths>
|
|
|
|
|
|
EOF
|
|
exit 3
|
|
}
|
|
|
|
if [[ "${1:-}" =~ ^- ]]; then
|
|
usage
|
|
fi
|
|
|
|
hdfs dfs -du "$@" |
|
|
awk '{ $1=""; print }' |
|
|
column -t
|