Files
tldr/pages.zh/common/choose.md

36 lines
830 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.

# choose
> 一个对人类友好且快速的替代工具,用于 cut 和有时的 awk。
> 更多信息: <https://github.com/theryangeary/choose>。
- 打印一行中的第5个项目从0开始
`choose {{4}}`
- 打印一行中的第一个、第3个和第5个项目其中项目由':'而不是空格分隔:
`choose --field-separator '{{:}}' {{0}} {{2}} {{4}}`
- 打印一行中从第2个到第5个项目包括第5个
`choose {{1}}:{{4}}`
- 打印一行中从第2个到第5个项目不包括第5个
`choose --exclusive {{1}}:{{4}}`
- 打印从行首到第3个项目
`choose :{{2}}`
- 打印从行首到第3个项目不包括
`choose --exclusive :{{2}}`
- 打印从第3个项目到行尾的所有项目
`choose {{2}}:`
- 打印一行中的最后一个项目:
`choose {{-1}}`