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 8158057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:29:41+00:00 2026-06-06T17:29:41+00:00

Is there a function, method, or language construction allowing to retrieve a single column

  • 0

Is there a function, method, or language construction allowing to retrieve a single column from a multi-dimensional array in Powershell?

$my_array = @()
$my_array += ,@(1,2,3)
$my_array += ,@(4,5,6)
$my_array += ,@(7,8,9)

# I currently use that, and I want to find a better way:
foreach ($line in $my_array) {
    [array]$single_column += $line[1]    # fetch column 1
}
# now $single_column contains only 2 and 5 and 8

My final goal is to find non-duplicated values from one column.

  • 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-06-06T17:29:42+00:00Added an answer on June 6, 2026 at 5:29 pm

    Sorry, I don’t think anything like that exist. I would go with:

    @($my_array | foreach { $_[1] })
    

    To quickly find unique values I tend to use hashtables keys hack:

    $UniqueArray = @($my_array | foreach -Begin { 
        $unique = @{} 
    } -Process { 
        $unique.($_[1]) = $null
    } -End { 
        $unique.Keys 
    })
    

    Obviously it has it limitations…

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

Sidebar

Related Questions

I use Multi-thread method in vs2008 ,use c++ language. when I use _beginthreadex function,
Evening, Is there a common or standardised name given to a function or method
Is there any way to override a class method with a lambda function? For
is there any example on using java method to call rhino-javascript function and return
how do I make my swap function in java if there is no method
In C or any ECMAscript based language you 'call a public method or function'
In the Io programming language, is there an equivalent to lisp's apply function. So
I use Linq to Entities to retrieve my records from DB. The function below
I have this Function/Method for filtering out a Blacklist of words in an ARRAY()
I know there is a method like this : setTimeout(functionA();,1250); That can delay my

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.