tinyapps.org / blog

Don't forget Windows shell scripting! #

In response to yesterday's post on sed, Armin Hanisch kindly wrote in to remind us that Windows shell scripts can be handy as well. He included the following shell script version of uniq, which he reports to work under NT4 and higher:

@echo off
if !%1 == ! goto noparm
if not exist %1 goto notfound

set line=@@@@@
for /F "usebackq tokens=*" %%f in (`sort %1`) do call :procline "%%f"
goto :eof

if !%line% == !%~1 goto :eof
set line=%~1
echo %~1
goto :eof

echo Usage: %~f0 [datei]
echo No file specified, terminating.
goto :eof

echo File %1 not found.
goto :eof

/windows | Nov 14, 2005

Subscribe or visit the archives