keep-header: add page (#8401)

pull/1/head
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
1 changed files with 20 additions and 0 deletions

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}}`