Files
tldr/pages.zh/common/keep-header.md

20 lines
623 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 保持头部
> 通过命令保持第一行不变,直接传递给 `stdout`。
> 更多信息:<https://github.com/eBay/tsv-utils#keep-header>。
- 对文件进行排序,保持第一行在顶部:
`keep-header {{path/to/file}} -- sort`
- 直接将第一行输出到 `stdout`,将文件的其余部分传递给指定的命令:
`keep-header {{path/to/file}} -- {{command}}`
-`stdin` 读取,排序除第一行外的所有行:
`cat {{path/to/file}} | keep-header -- {{command}}`
- 对文件进行 grep保持第一行不受搜索模式的影响
`keep-header {{path/to/file}} -- grep {{pattern}}`