Skip to content

Instantly share code, notes, and snippets.

@rram
Created July 25, 2022 19:26
Show Gist options
  • Save rram/7f21914cc89a9bda32041f8de431aeaa to your computer and use it in GitHub Desktop.
Save rram/7f21914cc89a9bda32041f8de431aeaa to your computer and use it in GitHub Desktop.
Highlight a word on standard input
#!/usr/bin/perl -w
use strict;
$| = 1;
die "No word provided" unless $ARGV[0];
my $word = $ARGV[0];
shift;
while(<>) {
s/$word/$&/g;
print;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment