Does anyone know any unix commands/perl script that would insert a specific character (that can be entered as either hex (ie 7C) or as the actual character (ie |)) in the po
# Get params and create part of the regex.
my $delim = "\\" . shift;
my $n = shift;
my $repl = shift;
my $wild = '.*?';
my $pattern = ($wild . $delim) x ($n - 1);
# Slurp.
$/ = undef;
my $text = <>;
# Replace and print.
$text =~ s/($pattern$wild)$delim/$1$repl/sg;
print $text;