Skip to content

Feature: Add Select-Object -SkipIndex parameter  #7278

@powercode

Description

@powercode

We already have an -Index parameter that select the specific indices we provide.
This would be the opposite, allowing us to specify the indices we want to exclude from the output.

PS> 1..5 | Select-Object -SkipIndex  2,3 

1
2
5

A real world example:

Disk Usage (du.exe) outputs a weird line "Processing..." in the middle of the output when asking for CSV output AND the output is redirected.

$a = du -q -nobanner -c .
$a

Path,CurrentFileCount,CurrentFileSize,FileCount,DirectoryCount,DirectorySize,DirectorySizeOnDisk
Processing...

"C:\Users\sgustafsson\vimfiles",2,3427,13,8,31129,94496

This makes conversion from csv an exercise in coding.
With my suggested parameter, it would be as simple as

du -q -nobanner -c . | Select-Object -SkipIndex 1,2 | ConvertFrom-Csv -delimiter ','

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions