Title: Get-Content -Head and -Tail should behave like head and tail with negative parameters · Issue #19710 · PowerShell/PowerShell · GitHub
Open Graph Title: Get-Content -Head and -Tail should behave like head and tail with negative parameters · Issue #19710 · PowerShell/PowerShell
X Title: Get-Content -Head and -Tail should behave like head and tail with negative parameters · Issue #19710 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/19710
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Get-Content -Head and -Tail should behave like head and tail with negative parameters","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n[SYSTEMATIC REVIEW](https://github.com/PowerShell/PowerShell/issues/19710#issuecomment-1562959738) by @mklement0\r\n\r\nGet-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.\r\n\r\nhttps://www.gnu.org/software/coreutils/manual/html_node/head-invocation.html\r\nhttps://www.gnu.org/software/coreutils/manual/html_node/tail-invocation.html\r\n\r\nCreate txt file:\r\n```ps1\r\n@\"\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n\"@ | Set-Content file.txt\r\n```\r\n\r\n\r\n### Expected behavior\r\n\r\n```console\r\nGet-Content file.txt -Head -3\r\nhead file.txt -n-3\r\n\r\n4\r\n5\r\n6\r\n\r\nGet-Content file.txt -Tail -3\r\ntail file.txt -n-3\r\n\r\n1\r\n2\r\n3\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\nGet-Content file.txt -Head -3\r\nGet-Content file.txt -Tail -3\r\n\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n```\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.3.4\r\nPSEdition Core\r\nGitCommitId 7.3.4\r\nOS Microsoft Windows 10.0.19045\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/CarloToso","@type":"Person","name":"CarloToso"},"datePublished":"2023-05-24T22:52:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/19710/PowerShell/issues/19710"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7cf665cd-9932-e708-72b2-87b1feb37669 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCB2:32AD0D:E14F5B:132D2F3:6A5563BB |
| html-safe-nonce | 72583fcba812763b7b0ef9d01c249aa229583836455e56334fd164d3e7d7aeb1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0IyOjMyQUQwRDpFMTRGNUI6MTMyRDJGMzo2QTU1NjNCQiIsInZpc2l0b3JfaWQiOiI1NTYwMTg2MDk1MzQ4ODM1MjU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7237386e3164b715125b2e6ecb1538dc90cd90c5662f89486d93638f1d533c52 |
| hovercard-subject-tag | issue:1724834875 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/19710/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9714ea7ff8bd4dc22885e12dd60a4a818e09db803ac481e99bcbc74307697875/PowerShell/PowerShell/issues/19710 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9714ea7ff8bd4dc22885e12dd60a4a818e09db803ac481e99bcbc74307697875/PowerShell/PowerShell/issues/19710 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | CarloToso |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8201d0b7bc32164c4662de52242e463a356df543 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width