Perhaps best explained with an example. I want to do this:
file:
one
two
three
command:
cat file | xargs -n1 show_square_of_stringed_number
output:
one one
two four
three nine
show_square_of_stringed_number two
just returns four
, and can only accept one argument.
Not looking for the implementation of show_square_of_stringed_number
, but simply how to echo the input to the pipe (two) alongside the output (four).
Wishing xargs
had this feature built in. Can't do it with tee <(show_square)
either because it operates on the entire list, not on a single row.