Skip to content

Get-Content -Head and -Tail should behave like head and tail with negative parameters #19710

@CarloToso

Description

@CarloToso

Prerequisites

Steps to reproduce

SYSTEMATIC REVIEW by @mklement0

Get-Content -Head and -Tail should behave like head and tail with negative parameters, I checked the code and this is by design but I think its not the corect behaviour.

https://www.gnu.org/software/coreutils/manual/html_node/head-invocation.html
https://www.gnu.org/software/coreutils/manual/html_node/tail-invocation.html

Create txt file:

@"
1
2
3
4
5
6
"@ | Set-Content file.txt

Expected behavior

Get-Content file.txt -Head -3
head file.txt -n-3

4
5
6

Get-Content file.txt -Tail -3
tail file.txt -n-3

1
2
3

Actual behavior

Get-Content file.txt -Head -3
Get-Content file.txt -Tail -3

1
2
3
4
5
6

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions