| Crates.io | zat |
| lib.rs | zat |
| version | 1.1.0 |
| created_at | 2023-12-13 16:49:24.284071+00 |
| updated_at | 2023-12-14 19:30:00.547441+00 |
| description | Print a range of lines of a file. |
| homepage | https://github.com/Axlefublr/zat |
| repository | https://github.com/Axlefublr/zat |
| max_upload_size | |
| id | 1068204 |
| size | 12,097 |
gimme zat
We have head to display the first n lines of a file, and we have tail to display the last n lines of a file, but I haven't heard of a program that does the opposite of those two: display a range of lines inside of a file.
This program lets you do exactly that!
zat file.txt
one
two
three
four
five
six
zat file.txt -s 2 -e 4
two
three
four
Use -s/--start to specify the first line you want to display, and up to the -e/--end line. Both the start and the end are inclusive.
Lines are 1-indexed, but 0 also means 1.
Specifying -s 0 -e 0 will just display the first line. The more natural way of doing this is -e 1.
Both flags are optional, so you could use this as a cat that doesn't concatenate (because cat does it already).
If you want to display a range of lines of stdin, rather than a file, just don't specify the file argument.
git --help | zat -s 12 -e 16
Print a range of lines of a file.
Usage: zat [FILE] [OPTIONS]
Options:
-s, --start <NUM>
-e, --end <NUM>
-h, --help Print help (see more with '--help')
-V, --version Print version
cargo install zat
cargo binstall and cargo quickinstall are also supported.
cargo uninstall zat