That Looks Completely Wrong

Meme time, via Bill:

history | awk '{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head

Hmm…

'history' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Eric>

3 Responses to “That Looks Completely Wrong”

It works fine on my Windoze system… of course I’m running cygwin as well. :)

Adam Says:

start with “doskey /history”, doing the analysis is left as an exercise for the reader

Adam Says:

@echo off
::This is hawk.cmd (hawk == history+awk stuff)
setlocal EnableDelayedExpansion
mkdir hawk_temp && pushd hawk_temp
doskey /history > __history.txt && for /f “usebackq” %%a in (__history.txt) do (echo.>> _%%a)
del __history.txt && set count=0 && for /f “usebackq” %%e in (`dir /b/o-s`) do (
set /a count = !count! + 1 && if !count! leq 10 (
set /a n = %%~ze / 2 && set file=%%e && set c=!file:~1!
if !n! geq 100 (echo !n! !c!) else (if !n! geq 10 (echo !n! !c!) else (echo !n! !c!))))
popd && rmdir /s/q hawk_temp > NUL 2>&1

Leave a Reply