sweept Posted February 22, 2013 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
Guest Posted February 22, 2013 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
sweept Posted February 23, 2013 Author Posted February 23, 2013 I couldn't have managed this without your help.100% worth's of understanding and help effort.Thank you 5eraph
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now