#!/usr/bin/env perl # Execute shell commands and include their output in the current buffer. # # See also: filter-exec for formatted output including the original command. use strict; use warnings; use 5.10.0; my $text; { # line separator: local $/ = undef; $text = <>; } $text =~ s{ .*? }{ handle_block($1); }egsx; print $text; sub handle_block { my ($command) = @_; my $result = `$command`; my $starter = 'exec-raw'; return "\n$result"; } __DATA__ A self-test - use ,r in vim to check: Mon Oct 31 16:54:45 MDT 2016 /home/brennen/code/bpb-kit $ ls apache2 bpb-kit_1.0_all.deb home install.sh ns-control README.md tags