Skip to content

Instantly share code, notes, and snippets.

@robshep
Created March 17, 2019 16:23
Show Gist options
  • Save robshep/570ec46cf173927c2585d838a1f91342 to your computer and use it in GitHub Desktop.
Save robshep/570ec46cf173927c2585d838a1f91342 to your computer and use it in GitHub Desktop.
Highlight a character at a position
#!/bin/bash
# Inserts a single Red background highlight at the chosen character position
# usage: hl -c <pos> <file>
#
# E.g. /usr/local/bin/hl -c 384 /tmp/query.sql
head $1 $2 $3; \
gecho -e -n "\e[41m"; \
tail $1 +`expr $2 + 1` $3 | head -c 1; \
gecho -e -n "\e[0m"; \
tail $1 +`expr $2 + 2` $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment