now i have a file that contents below this:
cd /export/ft_prod/j973/check19999/dir/export/j97x/56311/XC56311_RevA_R1_5C/XC56311_RevA_R1_5C_Hspeed/J973dbs/XC56311_RevA_R1_5C_Hspeed.wspdb
cd /export/ft_prod/j971/check19999/dir/export/j97x/56311/XC56311_RevA_R1_5C/XC56311_RevA_R1_5C_Hspeed/J973dbs/XC56311_RevA_R1_5C_Hspeed.wspdb
cd /export/ft_prod/j971/check19999/dir/export/j97x/56311/XC56311_RevA_R1_5C/XC56311_RevA_R1_5C_Hspeed/XC56311_RevA_R1_5C_Hspeed.preload

for my problems is i just want to capture the file start from cd .....
until the second "/",which means for first and second line is start from

cd.... until "J973dbs"(whitout the "/") .
and for third line is from cd .... until "XC56311_RevA_R1_5C_H"
(without the "/" ).

i try to use String command like this :
int i = line.indexOf("cd");
int j = line.lastIndexOf("/");
line = line.substring(i,j);


but i notice the result show only "cd /" and i think it is not flexible
cause what i want is always detect from the first character until the last
"/" sign
so do you have any command that i can use ?

by the way ,if slove for the first question,how can i detect the last
string after the last "/" ?


thanks a lot.