Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7523779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:54:06+00:00 2026-05-30T02:54:06+00:00

I typed the following command to find out how many unique objects there were

  • 0

I typed the following command to find out how many unique objects there were and it gave me 5. I don’t know why this gives 5.

> $var = @(2,4,2,5,3,6,34,6,3,6,4,6,3,5,5,353,5343,5,3,56,34)  
>$var | sort -Unique  
2  
3  
4  
5  
6  
34  
56  
353  
5343  
>$var | sort -Unique Count  
5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T02:54:08+00:00Added an answer on May 30, 2026 at 2:54 am

    $var | sort -Unique COUNT is the same as: $var | sort -Unique -Property COUNT

    So what sort is doing is looking for the “COUNT” property on each of the elements in the array to determine whether they are unique or not. You can see how this works if you do the following:

    GPS sv* | sort -Unique ID
    GPS sv* | sort -Unique Name
    

    Since none of the objects have a “COUNT” property, sort sees them all as the same and therefore none are unique and it is returning one of the elements. The clue came from trying the following:

    $var = $("a", "b", "c", "b")
    $var | sort -Unique count
    

    this produced the result “c”.

    Measure is your friend here:

    $var |sort -Unique |measure
    

    That should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following command that I run on cygwin: find /cygdrive/d/tmp/* -maxdepth 0
SOLVED readline - a library for editing typed command lines After following the Android
Consider the following command line output using grep: [gjempty@gjempty]$ find . -name *.php |
I ran the following command : find . -type f | xargs ls -ltrhg
I use following find command to find and show all files having the input
I executed the following command: find / -type f -name fs-type -exec svnlook tree
I currently use the following command, but it's a little unwieldy to type. What's
I have typed in the following text in a control derived from Richtextbox The
I'm currently doing the following to use typed datasets in vs2008: Right click on
I have the following code in a strongly-typed View in my application: <td> <label

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.