Skip to content

Instantly share code, notes, and snippets.

@Keith-S-Thompson
Created September 5, 2012 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keith-S-Thompson/3646922 to your computer and use it in GitHub Desktop.
Save Keith-S-Thompson/3646922 to your computer and use it in GitHub Desktop.
highlight command
#!/usr/bin/perl
use strict;
use warnings;
if (scalar @ARGV == 0 or $ARGV[0] eq '-h' or $ARGV[0] eq '-help') {
die "Usage: $0 pattern [file...]\n";
}
my $pattern = shift;
my $start = "\e[1m";
my $end = "\e[0m";
while (<>) {
s/$pattern/$start$&$end/g;
print;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment