https://github.com/mle86/hi
Highlights lines that contain keywords.
https://github.com/mle86/hi
ansi-colors c command-line-tool grep-like highlight keyword-detection linux
Last synced: 3 months ago
JSON representation
Highlights lines that contain keywords.
- Host: GitHub
- URL: https://github.com/mle86/hi
- Owner: mle86
- License: gpl-3.0
- Created: 2019-02-03T22:16:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-19T15:02:24.000Z (about 7 years ago)
- Last Synced: 2025-03-04T12:32:32.416Z (over 1 year ago)
- Topics: ansi-colors, c, command-line-tool, grep-like, highlight, keyword-detection, linux
- Language: C
- Size: 69.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: COPYING
Awesome Lists containing this project
README
[//]: # (This file was autogenerated from the man page with 'make README.md')
# hi(1) - highlights lines containing keywords
[](https://travis-ci.org/mle86/hi)
[](/COPYING)
Version 2.1.0, February 2019
hi [-l|-w|-p] [OPTIONS] [--] KEYWORD...
hi -L [OPTIONS] [--] RANGE...
# Description
**hi** reads text from the standard input
and prints its input on the standard output.
Lines containing at least one of the given keywords
will be colorized
with ANSI escape codes.
# Installation
```
$ make
# make install
```
This will compile the binary and copy it to /usr/local/bin/**hi**.
The man page will be copied to /usr/local/share/man/man.1/**hi.1.gz**.
# Modes
The program operates in one of several
**output modes.**
The default output mode is **-l**.
* **-l, --lines**
Highlight lines:
All lines containing at least one of the *KEYWORD*s
will be highlighted in the output.
* **-p, --paragraphs**
Highlight paragraphs:
All paragraphs containing at least one of the *KEYWORD*s
will be highlighted in the output.
* **-w, --words**
Highlight words:
Only the *KEYWORD*s themselves
will be colorized in the output.
* **-L, --explicit, --ranges**
Explicit mode:
In this mode, there are no *KEYWORD*s.
Instead,
the program takes one or more line number *RANGE*s
which will be colorized.
For example, the invocation
“**hi -L 3 8-10 5**”
will highlight lines 3, 5, 8, 9, and 10
but nothing else.
Line numbers start at 1.
# Options
* **-i**, **--ignore-case**
Enable case-insensitive matching.
This is the default.
Note that the program is unaware of locales
and can only compare plain ASCII letters (**A**..**Z**)
case-insensitively; all other characters will be compared byte-for-byte.
* **-I**, **--case-sensitive**
Enable case-sensitive matching.
The opposite of **-i**.
* **-c**, **--color** *COLOR*
Select the output highlighting color.
Recognized colors are:
* **yellow**/**ye**/**yw**
(default),
* **red**/**re**/**rd**,
* **blue**/**bl**,
* **green**/**gr**/**gn**,
* **cyan**/**cy**/**cn**,
* **white**/**wh**.
* **-h**, **--help**
Show program help.
* **-V**, **--version**
Show program version information.
# License
This program is released under the
[GPLv3 license](https://www.gnu.org/licenses/gpl.html).
It includes the "nstr" module
from the
[csv-parser project](https://github.com/mle86/csv-parser)
which is released under the
[MIT license](https://opensource.org/licenses/MIT).
# Author
Maximilian Eul <[maximilian@eul.cc](mailto:maximilian@eul.cc)>
(https://github.com/mle86)