Solved Removing duplicate text in a txt file using bat

June 4, 2012 at 21:37:23
Specs: Windows 7
Hi,

Let's say, I have a txt named Data.txt

The text has alot of duplication information like,

Scanning; Files found! -> 123456789
Scanning; Files found! -> 238586792
Scanning; Files found! -> 123456789

notice the 1st and 3rd line has the same information. Is it possible to delete duplicates and keep only 1 using a bat command or is it not?


See More: Removing duplicate text in a txt file using bat

Report •


#1
June 5, 2012 at 03:45:47
✔ Best Answer
:: ===== script starts here ===============
::
:: kato.bat Tue 05-06-2012 17:02:06.75
@echo off > newfile & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in (Data.txt) do (
find "%%a" < newfile > nul || >> newfile echo.%%a
)
goto :eof
::====== script ends here =================


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
June 5, 2012 at 04:15:29
works perfectly!!! thanks!!!

Report •
Related Solutions


Ask Question