this question has answer here:
- get file directory path file path 6 answers
my problem statement having whole hdfs path may or may not have part* @ end on this.
like: /user/root/daily_file/part* or /user/root/daily_file/p*
i have above string in 1 variable in shell script.
but want remove last part* or p* ever have in between "/" , "*".
my code snippet is:
hdfs_path="/user/root/daily_file/part*" hdfs dfs -test -e $hdfs_path rc=$? if [ "$rc" -eq "0" ] echo -e "path exist !!! \n" if
due path -
i think want this:
var="/user/root/daily_file/part*" echo "${var%/*}"
if want /user/root/daily_file/
, then: newvar="${var%/*}/"
Comments
Post a Comment