Created
July 25, 2022 19:26
-
-
Save rram/7f21914cc89a9bda32041f8de431aeaa to your computer and use it in GitHub Desktop.
Highlight a word on standard input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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