paste output of two commands
I am trying the following command but its not working:
paste < (awk '{ print $1 }' file1 | program1 ) < (awk '{ print $2 }' file2 | program2) |
Could you please explain, what you expected what the command would do. What are program1 and program2?
Markus |
Quote:
I want to print the output of two independent commands on the same line side by side, for example: If output of command one is "AAAA" and output of command two is "BBBB" then I want to produce an output such as: AAAA BBBB program1 and program2 are scripts that take input, perform some calculations and produce output. Thanks PS: when I use my earlier line I get the error: Missing name for redirect. |
I can't replicate that same error message, but you need to lose the spaces between "<" and "(". The "<(" that introduces process substitution is a single token and must not be broken up.
|
I don't see that this question is any different from the topic you have running already here:
http://www.linuxquestions.org/questi...6/#post4825971 We usually want to keep conversations on the same topic together. So only create a new threads if your question is substantially different from the previous ones. But yeah, to follow up on the above, bash's process substitution is a simplified, automated way to create a background fifo. In essence "<(..)" (no space) acts like a file that contains the output of the commands contained in it. If needed, this can be then redirected as normal with another "<". e.g.: Code:
$ tr ":" "-" < <( echo "foo:bar" ) But for commands that can read from files directly, the extra redirection isn't needed: Code:
$ cat <( echo "foo:bar" | tr ":" "-" ) |
All times are GMT -5. The time now is 12:48 PM. |