Highlight terms in output or files to assist with visual scanning
Ruby Cucumber
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
features
lib
man
.gitignore
.ruby-gemset
.ruby-version
Gemfile
LICENSE.txt
README.md
Rakefile
hl.gemspec

README.md

hl(1) -- Highlight text in an output stream or file

SYNOPSIS

hl [options] PATTERN [FILE...]

hl [options] -p PATTERN [FILE...]

INSTALL

$ gem install hl

DESCRIPTION

hl higlights (using ANSI escape sequences) instances of PATTERN in the named input FILEs or standard in if none are specified. hl's goal is to assist visually scanning such output, but without trimming that output as grep(1) would. The most common use-case is when trying to scan the output of a grep invocation that has complex data or long lines. In this case, you don't want to further grep the output for the term you're looking for, bit instead simply need a visual cue as to where the secondary search term is in the output.

PATTERN can be a plain string, or a regular expression.

OPTIONS

  • -c COLOR, --color=COLOR: Color to use for highlighting. Available colors are red, green, yellow, blue, magenta, cyan, or white, with yellow being the default.

  • -n, --[no-]inverse: Inverse highlight. Shows the highlighting in inverse, with the background of the highlight being the selected color and the foreground being the color of your terminal's background. This is off by default

  • -i, --[no-]ignore-case: Ignore case when matching. This is off by default.

  • -u, --[no-]underline: Underline highlight. This is off by default.

  • -b, --[no-]bright: Use bright colors. Shows the highlighting using the bright version of the color. This is off by default.

  • -p PATTERN, --regexp=PATTERN: Search term as explicit option. This is useful for searching for patterns that start with a dash.

  • -h, --help, --version: Show the version and help information

ENVIRONMENT

Default options can be specified in the HL_OPTS environment variable, exactly as they would appear on the command line. You can override these switches with the -no- form of the options

EXAMPLES

Highlight the output of grep

grep '2012-01-02' some_log_file.txt | hl 'user_id'

Highlight the word "user_id" in bright cyan in several files

hl --color=cyan -b user_id some_file some_other_file yet_a_third_file

BUGS

  • Does not allow for highlighting multiple terms at once

AUTHOR

David Copeland, davec (at) naildrivin5.com

COPYRIGHT

hl is copyright(c) 2012 by David Copeland, released under the Apache license.

SEE ALSO