Sub String

Hi All,

supose my string is like

Home/Fruite/Apple

i need to remove last word from string.

i want to get Home/Fruite/ only

Thanks,
Arun

 
man dirname

string is like

s1=Home/Fruite/Apple

i need sub string from s1

It is simple .. What you have tried to achieve the output ..

 
echo "$s1" | awk '{print $NF}'

---------- Post updated at 02:03 PM ---------- Previous update was at 02:02 PM ----------

 
dirname $s1
 
$ echo $s | awk -F/ '{$NF="" ; print}' OFS=/
Home/Fruite/

tnx jay n kamaraj