https://github.com/alexdelorenzo/nth_py
https://github.com/alexdelorenzo/nth_py
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alexdelorenzo/nth_py
- Owner: alexdelorenzo
- License: agpl-3.0
- Created: 2020-08-31T19:14:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-05T04:06:18.000Z (over 3 years ago)
- Last Synced: 2025-01-18T22:48:35.533Z (5 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nth_py
Return or exclude the `nth` lines supplied from stdin as output on stdout. See the Rust version of this utility here: [nth_rs](https://github.com/alexdelorenzo/nth_rs).# Install
```bash
pip3 install nth_py
```# Usage
```bash
$ dmesg | nth 0 1 2 3
[ 4.095065] xhci-hcd xhci-hcd.3.auto: xHCI Host Controller
[ 4.100328] xhci-hcd xhci-hcd.3.auto: new USB bus registered, assigned bus number 4
[ 4.107985] xhci-hcd xhci-hcd.3.auto: Host supports USB 3.0 SuperSpeed
[ 4.109677] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, actual 50000000HZ div = 0)```
To better illustrate, let's enumerate each line of stdin:
```bash
$ dmesg | count | nth 0 1 2 3
0 [ 4.095065] xhci-hcd xhci-hcd.3.auto: xHCI Host Controller
1 [ 4.100328] xhci-hcd xhci-hcd.3.auto: new USB bus registered, assigned bus number 4
2 [ 4.107985] xhci-hcd xhci-hcd.3.auto: Host supports USB 3.0 SuperSpeed
3 [ 4.109677] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, actual 50000000HZ div = 0)
```# License
See `LICENSE`. If you'd like to use this project with a different license, please get in touch.