mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Print A Range Of Lines For A File With Bat as a unix til
This commit is contained in:
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
|||||||
For a steady stream of TILs from a variety of rocketeers, checkout
|
For a steady stream of TILs from a variety of rocketeers, checkout
|
||||||
[til.hashrocket.com](https://til.hashrocket.com/).
|
[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)
|
- [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)
|
- [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)
|
- [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)
|
- [Repeat Yourself](unix/repeat-yourself.md)
|
||||||
- [Saying Yes](unix/saying-yes.md)
|
- [Saying Yes](unix/saying-yes.md)
|
||||||
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
|
- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md)
|
||||||
|
|||||||
19
unix/print-a-range-of-lines-for-a-file-with-bat.md
Normal file
19
unix/print-a-range-of-lines-for-a-file-with-bat.md
Normal 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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
See `man bat` for more details.
|
||||||
Reference in New Issue
Block a user