How to merge two files in awk??
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Mon Jan 21 04:21:14 AEST 1991
In article <1991Jan19.194124.2335 at convex.com> tchrist at convex.COM (Tom Christiansen) writes:
> : for example if File A has collumns a, c, e
> : and File B has collumns b, d, f. I want to generate File C
> : with collumns a,b,c,d,e,f. Also it would be nice to be able to
> : using the arithematic feature in awk...
> Someone out there may have as paste solution, but I didn't see one.
Is that a challenge?
#!/bin/sh
# untested, but too simple to fail in strange ways
# type X as tab
awk '{ print $1; print $2; print $3 }' < "$1" > /tmp/file1.$$
awk '{ print $1; print $2; print $3 }' < "$2" > /tmp/file2.$$
paste /tmp/file1.$$ /tmp/file2.$$ | (
while read i
do
read j; read k
echo "$iX$jX$k"
done
)
rm /tmp/file1.$$ /tmp/file2.$$
---Dan
More information about the Comp.unix.questions
mailing list