Q:

Is there a unix command line utilty for 'mapping' by line? 

I have an input stream, and I want to "map" to output lines.  For instance, if my input stream were the files nums, I'd want that this syntax
$ cat nums
9534
2343
1093
7023
$ cat nums | map ./myscript $0

would be equivalent to
$ echo 9534 | ./myscript
$ echo 2343 | ./myscript
$ echo 1093 | ./myscript
$ echo 7023 | ./myscript

A:

I think xargs is the closest thing to your hypothetical map:
cat nums | xargs -n1 ./myscript

or
cat nums | xargs -n1 -J ARG ./myscript ARG

or
cat nums | xargs -I ARG ./myscript ARG

Unfortunately, xargs doesn't let you invoke things that read from stdin, so you'd have to rewrite your script to accept a command-line argument rather than reading from stdin. 

A:

#! /bin/bash
while read -r line
do
  "$@" <<< "$line"
done

