1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00

Add Print A Range Of Lines For A File With Bat as a unix til

This commit is contained in:
jbranchaud
2019-03-27 14:48:41 -05:00
parent 629c15aeb4
commit 89dc799bac
2 changed files with 21 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
For a steady stream of TILs from a variety of rocketeers, checkout
[til.hashrocket.com](https://til.hashrocket.com/).
_797 TILs and counting..._
_798 TILs and counting..._
---
@@ -739,6 +739,7 @@ _797 TILs and counting..._
- [Open The Current Command In An Editor](unix/open-the-current-command-in-an-editor.md)
- [Partial String Matching In Bash Scripts](unix/partial-string-matching-in-bash-scripts.md)
- [PID Of The Current Shell](unix/pid-of-the-current-shell.md)
- [Print A Range Of Lines For A File With Bat](unix/print-a-range-of-lines-for-a-file-with-bat.md)
- [Repeat Yourself](unix/repeat-yourself.md)
- [Saying Yes](unix/saying-yes.md)
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)

View File

@@ -0,0 +1,19 @@
# Print A Range Of Lines For A File With Bat
I recently learned about a [faster and more colorful alternative to
cat](https://chireviewofbooks.com/2018/12/11/here-are-the-winners-of-the-2018-chicago-review-of-books-awards/)
-- [`bat`](https://github.com/sharkdp/bat). Like `cat`, the standard usage
is to print the entire contents of a file. You can instruct `bat` to only
print a range of lines from a file using the `--line-range` flag.
For instance the following command
```bash
$ bat --line-range=918:925 README.md
```
will produce the following output
![a range of lines from the README](https://i.imgur.com/MmKbNvl.png)
See `man bat` for more details.