pipe and paste
Hi I want to combine the output of two commands in this form
awk 'Complex command' file1 | awk ' Different complex command' file2 but i want the ouptuts on the same line another option might be awk 'Complex command' file1 | paste < (` awk ' Different complex command' file2`) but neither is working any ideas ? Thanks |
Well it depends what 'Complex command' is. Is 'file2' a result of processing 'file1'?
Maybe something like this might be what you want? cat 'file1' | awk 'Complex command' | awk ' Different complex command' > 'file2' |
Quote:
Thanks but thats not what i want , I m trying to show the output of two entirely independent awk command on the same line |
cat file | awk command
is almosst the same as awk command file, but needs more resources. Probably you can do the following: awk command1 file1 > result1 awk command2 file2 > result2 paste result1 result2 |
I think you want the two commands to run in a group and redirect the output to a file.
Code:
{ awk -f awkscript1 file1; awk -f awkscript2 file2; } >results Another option is to append to the file from inside your awk scripts. |
Or maybe using process substitution:
Code:
paste <(awk 'statements' file1) <(awk 'statements' file2) > result |
Quote:
Im trying to do it without temporary files inbetween |
Quote:
When I do this, I get the following error: Missing name for redirect |
Quote:
When I do this it gives me the following error: {: Command not found. |
may be this would help, my actual command is something like this
1st command : awk '{ print $1, $2 }' file1 | program3 2nd command : awk '( print $2, $3 }' file2 | program3 program 3 is a script that takes input and performs certain calculations and produces output |
How about:
awk '{ printf $1, $2 }' file1 | program3 && awk '( print $2, $3 }' file2 | program3 |
Quote:
This produces the output one after the other: AA BB but I want them side by side : AA BB |
Quote:
|
Quote:
|
Quote:
|
All times are GMT -5. The time now is 09:08 AM. |