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
The pmap command in Linux is used to display the memory map of a process. A memory map indicates how memory is spread out. Syntax: pmap [options] pid [...]
map (default). This file is ASCII-text formatted, and can be modified with a standard text editor. However, this file should not be modified unless the administrator is instructed to do so by the cluster softwre service provider. If this configuration file is to be modified, the default /opt/rsct/cfg/unix.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With