1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-01 15:15:23 +02:00

keep-header: add page (#8401)

This commit is contained in:
Cornelius Roemer 2022-08-30 21:51:26 +02:00 committed by GitHub
parent d360ef4418
commit be742fa374
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,20 @@
# keep-header
> Keep first line untouched by a command, passing it directly to stdout.
> More information: <https://github.com/eBay/tsv-utils#keep-header>.
- Sort a file and keep the first line at the top:
`keep-header {{path/to/file}} -- sort`
- Output first line directly to stdout, passing the remainder of the file through the specified command:
`keep-header {{path/to/file}} -- {{command}}`
- Read from stdin, sorting all except the first line:
`cat {{path/to/file}} | keep-header -- {{command}}`
- Grep a file, keeping the first line regardless of the search pattern:
`keep-header {{path/to/file}} -- grep {{pattern}}`