How can I use Powershell to remove dupliation within a file?
Posted on 2014-09-23
I am currently working with this script.
I need to convert this script to a Powershell script.
It looks within a file for duplication, and if there is duplication it deletes the duplication.
REM Defile file location
REM Error if file does not exist
if not exist "%File1%" (
REM Remove duplicate lines from the file
copy NUL "%Workfile%" >NUL
for /f "tokens=* usebackq" %%B in ("%File1%") do (
findstr /b /e /c:"%%B" /i "%Workfile%">NUL || echo.%%B>>"%Workfile%"
copy /y "%Workfile%" "%File1%" >NUL
if exist "%Workfile%" del "%Workfile%"