sweept Posted February 22, 2013 Share Posted February 22, 2013 (edited) hi, I'm trying to strip out pairs of names (none defined) holding different .ext, from inside a text fileMeaning; if a name appears more then once, Then it's name will get stripped regardless its extension: indexFrance.pdfEn.txtEn.pdfEn.ini.....-after:New_indexFrance.pdfTIAEdit: also, if this can be written without a subroutine to make it simpler .. Edited February 22, 2013 by sweept Link to comment Share on other sites More sharing options...
Guest Posted February 22, 2013 Share Posted February 22, 2013 (edited) This should work, but is untested. Working here as written below.@ECHO OFFSETLOCAL EnableDelayedExpansionFOR /F "usebackq delims=" %%# IN ("index.txt") DO ( SET "bMoreThanOnce=" FOR /F "usebackq delims=" %%_ IN ("index.txt") DO ( IF /I "%%~n_"=="%%~n#" ( IF /I NOT "%%_"=="%%#" SET "bMoreThanOnce=Defined" ) ) IF NOT DEFINED bMoreThanOnce ECHO>>"New_index.txt" %%#) Edited February 23, 2013 by 5eraph Link to comment Share on other sites More sharing options...
sweept Posted February 23, 2013 Author Share Posted February 23, 2013 I couldn't have managed this without your help.100% worth's of understanding and help effort.Thank you 5eraph Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now