-
hoe to capture certain part of the line in file ?
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks