7 个版本 (4 个破坏性更新)
| 0.6.0 | 2023年9月17日 | 
|---|---|
| 0.5.1 | 2023年9月17日 | 
| 0.5.0 | 2023年2月10日 | 
| 0.4.0 | 2020年4月29日 | 
| 0.2.1 | 2020年4月16日 | 
#1221 在 命令行工具
每月下载量:34
9KB
175 行
btwn
命令行应用程序,用于根据范围表达式从 stdin 过滤行,如 '1..=3'。
我创建了它,因为它比尴尬的 head 和 tail 组合更容易使用。
$ btwn --help
btwn - command line range filter tool
Filters lines based on the given range expression.
Examples:
'3'       - line 3 only
'2..6'    - lines 2 to 6 exclusive
'2..=6'   - lines 2 to 6 inclusive
'3..'     - lines 3 onwards
'..4'     - lines 1 to 4 exclusive
USAGE:
    btwn [OPTIONS] <range>
FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
OPTIONS:
    -i, --input <FILE>    Input file (defaults to stdin)
ARGS:
    <range>    A range filter expression, e.g. '1..5'
安装
从 crates.io
运行
$ cargo install btwn
从 git
克隆存储库并运行
cargo install --path .
或者从 GitHub 发布页面获取发布版本。
示例用法
$ cat test.txt
a
b
c
d
e
行 2 到 5(不包含第 5 行)
$ cat test.txt | btwn 2..5
b
c
d
行 2 到 5(包含第 5 行)
$ cat test.txt | btwn 2..=5
b
c
d
e
从第 2 行开始
$ cat test.txt | btwn 2..
b
c
d
e
行 1 到行 4(包含第 4 行)
$ cat test.txt | btwn ..=4
a
b
c
d
依赖关系
~750KB