3 ms·
MS-DOS 6.22 C:\>grep '^[qwertyuiop]*$' /usr/share/dict/words | awk '{print length, $0}' | sort -rn | head Bad command or file name Bad command or f
by p1mrx 3y ago
MS-DOS 6.22
C:\>grep '^[qwertyuiop]*$' /usr/share/dict/words | awk '{print length, $0}' | sort -rn | head
Bad command or file name
Bad command or file name
SORT: Too many parameters
Bad command or file name
- jodrellblank 3y agoMS-DOS 6.22 (excluding any typos as I rewrote it, I only did a proof of concept with a few words but it seemed to work). @echo off mkdir c:\t echo prompt echo %1 $g C:\t\%1 >> c:\temp.bat command /c temp.bat %1 > c:\h.bat del c:\temp.bat type words.txt | find /V "a" | find /V "s" | find /V "d" | find /V "f" | find /V "g" | find /V "h" | find /V "j" | find /V "k" | find /V "l" | find /V "z" | find /V "x" | find /V "c" | find /V "v" | find /V "b" | find /V "n" | find /V "m" > c:\words2.txt echo > h.bas DIM word as STRING echo >> h.bas OPEN "C:\words2.txt" for INPUT as #1 echo >> h.bas DO WHILE NOT EOF(1) echo >> h.bas INPUT #1, word echo >> h.bas CMD$ = "C:\h.bat " + word echo >> h.bas SHELL CMD$ echo >> h.bas LOOP echo >> h.bas CLOSE #1 echo >> h.bas SYSTEM qbasic /RUN c:\h.bas dir /OS /B c:\t @del c:\t\* @rmdir c:\t @del c:\words2.txt @del c:\h.bat @del c:\h.bas You can play with MS-DOS 6.22 in a virtual-machine-in-browser here[1]. That VM comes with Vim (non-standard) so use Vim or Edit to create a word list and save as c:\words.txt. Then yype all this code into a batch file using `edit run.bat` and then run it with `run %1`. MS-DOS 6.22 came with QBASIC so I think that's allowed; I tried to avoid it but wasn't able to. NB. DOS is way less capable than Windows cmd prompt so there's no `for /f` or anything. "Dir /OS /B" sorts files by size and that view will leave the largest files on screen as the answer. The files will be one per word, containing the word so the size in bytes is the word length and the filename is the word to see it in the file listing. The words will be echoed into the files by a helper batch file containing `echo %1 > %1`. Building the helper batch file is hard because echo cannot echo > into a file. The qwerty filtering is a chain of `find /V "a"` for excluding each of the other rows cough. I then couldn't loop over the file lines without QBASIC. [1] https://copy.sh/v86/?profile=msdos https://copy.sh/v86/?profile=msdos If you never used MS-DOS classic, try "edit test.txt" and see how it has a nice TUI, where Alt+F brings up the File menu, the brightly coloured letters are the hotkeys, so Alt+F, X will quit. Shift+Down will select a line, Shift+Delete to cut and Shift+Insert to paste. Ctrl+left/right arrows to jump forward/back a word, Ctrl+Shift+Left/Right to select a word. 29 years later those keyboard patterns still work in this FireFox editor, in current notepad, WordPad and Word, and in my muscle memory. Escape tends to exit back out of popups and menus. Quit and try "help date" and see the TUI help, where the green angle brackets are hyperlinks and can be TAB'ed between, Enter to activate and Escape back. F1 is still the help key, only it actually showed offline help back then instead of doing a Bing search for 'get help in notepad'. Quit and run QBasic, see how F5 runs the code. [2] by Geoff Cutter: https://groups.google.com/g/alt.msdos.batch/c/Ozg2C-ANCqI https://groups.google.com/g/alt.msdos.batch/c/Ozg2C-ANCqI [3] Phil Robyn's QBASIC loop sample https://groups.google.com/g/alt.msdos.batch/c/44NbdZJ2-p4/m/ADlnaOFkRHoJ https://groups.google.com/g/alt.msdos.batch/c/44NbdZJ2-p4/m/...