Skip to content

Commit 89dc799

Browse files
committed
Add Print A Range Of Lines For A File With Bat as a unix til
1 parent 629c15a commit 89dc799

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010
For a steady stream of TILs from a variety of rocketeers, checkout
1111
[til.hashrocket.com](https://til.hashrocket.com/).
1212

13-
_797 TILs and counting..._
13+
_798 TILs and counting..._
1414

1515
---
1616

@@ -739,6 +739,7 @@ _797 TILs and counting..._
739739
- [Open The Current Command In An Editor](unix/open-the-current-command-in-an-editor.md)
740740
- [Partial String Matching In Bash Scripts](unix/partial-string-matching-in-bash-scripts.md)
741741
- [PID Of The Current Shell](unix/pid-of-the-current-shell.md)
742+
- [Print A Range Of Lines For A File With Bat](unix/print-a-range-of-lines-for-a-file-with-bat.md)
742743
- [Repeat Yourself](unix/repeat-yourself.md)
743744
- [Saying Yes](unix/saying-yes.md)
744745
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Print A Range Of Lines For A File With Bat
2+
3+
I recently learned about a [faster and more colorful alternative to
4+
cat](https://chireviewofbooks.com/2018/12/11/here-are-the-winners-of-the-2018-chicago-review-of-books-awards/)
5+
-- [`bat`](https://github.com/sharkdp/bat). Like `cat`, the standard usage
6+
is to print the entire contents of a file. You can instruct `bat` to only
7+
print a range of lines from a file using the `--line-range` flag.
8+
9+
For instance the following command
10+
11+
```bash
12+
$ bat --line-range=918:925 README.md
13+
```
14+
15+
will produce the following output
16+
17+
![a range of lines from the README](https://i.imgur.com/MmKbNvl.png)
18+
19+
See `man bat` for more details.

0 commit comments

Comments
 (0)