UNIQ(1plan9)

πŸ’– UNIQ(1plan9) πŸ’–

okay bestie, welcome to uniq β€” it's the plan9 girlie whose whole personality is reporting repeated lines in a file. she's giving quiet luxury, she's giving deduplication, and she is so easy to love once you get her ✨


🌸 SYNOPSIS 🌸

uniq [ -udc [ +-num ] ] [ file ]

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: uniq copies the input file, or the standard input if you didn't hand her a file, and drops it straight onto the standard output β€” comparing adjacent lines as she goes. 🌈

In the normal case (no flags, just vibing), the second and succeeding copies of repeated lines get removed. like, bye πŸ‘‹ one copy stays, the clones are gone.

⚠️ real talk though: repeated lines must be adjacent in order to be found. she is NOT scanning the whole file for you. if your dupes are scattered, that's not her problem, bestie β€” that's a sort(1) problem. πŸ’€

✨ OPTIONS ✨

  • -u β€” print unique lines. just the ones that show up once. main character only πŸ‘‘
  • -d β€” print (one copy of) duplicated lines. the repeats get to stay, but only one of them, no group-chat spam.
  • -c β€” prefix a repetition count and a tab to each output line. and yes, she's dramatic: this implies -u and -d. both. at once. she contains multitudes πŸ’…
  • -num β€” the first num fields, together with any blanks before each, get ignored. a field is defined as a string of non-space, non-tab characters separated by tabs and spaces from its neighbors. so like, skip the first num fields, blanks included, no cap πŸŽ€
  • +num β€” the first num characters get ignored. and the tea here: fields are skipped before characters. order matters, iykyk 🧚

🌟 SOURCE 🌟

/src/cmd/uniq.c

πŸ’œ SEE ALSO πŸ’œ

  • sort(1) β€” the other half of this situationship fr fr 🫢

πŸ™ˆ BUGS πŸ™ˆ

field selection and comparison should be compatible with sort(1). that's it, that's the bug note. she said "it should be" and left it at that 😭


and that's the whole page, bestie!! this lil icon lives in the plan9 manual as UNIQ(1plan9) β€” you can catch her under UNIQ(1plan9), and no date on the footer, so she's just timeless like that β­πŸ’– slay, go dedupe something, periodt ✨

πŸ“¦ where this page comes from