• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Extract a file name from a full (variable) file path

P0lar

Member
I have a list of xml command lines in excel (text fields) such as:

-f /tv/ss/ex/dub/config/agedet_one2one_run.xml -s<s> -e<e> > /tv/ss/ex/dub/config/run_agedet.log 2>&1

-f /tv/ss/in/au/config/agedet_out_run.xml -s<s> -e<e> > /tv/ss/ex/dub/config/run_agedet.log 2>&1

-f /tv/ss/ex/con/agedet_team_run.xml -s<s> -e<e> > /tv/ss/ex/dub/con/run_agedet.log 2>&1

and I need to extract the filenames which are immediately before the .xml part in all cases (so the agedet_one2one_run.xml part for example). The filepaths are always slightly different and there can be different numbers of folders in the string. The filenames always end .xml -s.

I'm looking for a text formula which will return the text string between the last "/" in the first path of the string and ".xml" (the bit hopefully in blue)
 
Oops..! didn't checked the last string :confused:, here is the revised one, but little long:

=SUBSTITUTE(SUBSTITUTE(A1,MID(A1,FIND("/",A1)-3,FIND(CHAR(135),SUBSTITUTE(A1,"/",CHAR(135),IF(LEN(MID(A1,FIND("/",A1)-3,FIND(CHAR(135),SUBSTITUTE(A1,"/",CHAR(135),6))))<30,6,5)))),""),MID(A1,FIND(".xml",A1),99),"")

Regards,
 
Thanks for the pointers, got most of the records working now using the following monster... had to adjust as the number of directories in the path can vary and the string contains two paths, one of which isn't needed...

=MID(SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/",CHAR(135),LEN(LEFT(A1,FIND(">",A1)))-LEN(SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/",""))),FIND(CHAR(135),SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/",CHAR(135),LEN(LEFT(A1,FIND(">",A1)))-LEN(SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/","")))),FIND(" ",SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/",CHAR(135),LEN(LEFT(A1,FIND(">",A1)))-LEN(SUBSTITUTE(LEFT(A1,FIND(">",A1)),"/",""))),32))
 
Back
Top