BASIC-DOS

A PCjs Retro-Programming Project

BASIC-DOS is on Twitter Project maintained by jeffpar

BASIC-DOS Manual

UNIQ

UNIQ [/C] [/D] [/I] [/U] [file]

A filter that displays input (or file), with each run of identical lines displayed only once, like the UNIX uniq command. Only adjacent lines are compared, so input is usually sorted first (eg, SORT NAMES.TXT | UNIQ, or since SORT ignores case, SORT NAMES.TXT | UNIQ /I).

  • /C puts the number of times each line occurred in front of it
  • /D displays only the lines that were repeated
  • /I ignores case (displaying the first line of each run)
  • /U displays only the lines that weren’t repeated

For example:

UNIQ /C NAMES.TXT
      1 One
      2 Two
      1 three
      1 Four five
UNIQ /D NAMES.TXT
Two

ERRORLEVEL is set to 0, or 2 if file couldn’t be opened (eg, Unable to find X.TXT).

Source: uniq.asm

« TREEVI »

Copyright (c) 2020-2026 Jeff Parsons Released under MIT License