Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Recommended Posts

hi, I'm trying to strip out pairs of names (none defined) holding different .ext, from inside a text file

Meaning; if a name appears more then once, Then it's name will get stripped regardless its extension

: index

France.pdf
En.txt
En.pdf
En.ini
.....

-after

:New_index

France.pdf

TIA

Edit: also, if this can be written without a subroutine to make it simpler ..

Edited by sweept

Share this post


Link to post
Share on other sites

Guest

This should work, but is untested. Working here as written below.

@ECHO OFF
SETLOCAL EnableDelayedExpansion
FOR /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 by 5eraph

Share this post


Link to post
Share on other sites

I couldn't have managed this without your help.

100% worth's of understanding and help effort.

Thank you 5eraph :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×