Use xargs to Pipe Output to Script As Command Line Argument
A script normally accepts command line argument and also accepts output from another script as parameters.say two perl scripts:
a.pl:
#!/usr/bin/perl
print "1\n2\n3\n";
b.pl
#!/usr/bin/perl
my $argc = 0;
foreach my $arg (@ARGV) {
printf "Argument %2d: '%s'\n", ++ $argc, $arg;
}
In Linux, we can use xargs to pipe output of one command as command line argument of another command, like:
a.pl | xargs b.pl
a.pl | xargs b.pl 4 5 6
But seems there is no such command like xargs in Windows.
Still need find a way to support pipe output to script as command line argument in Windows.
or find how to implement this function directly in Perl script.