Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think.com!paperboy!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: How to merge two files in awk?? Message-ID: <25041:Jan2017:21:1491@kramden.acf.nyu.edu> Date: 20 Jan 91 17:21:14 GMT References: <3404@d75.UUCP> <1991Jan19.194124.2335@convex.com> Organization: IR Lines: 24 In article <1991Jan19.194124.2335@convex.com> tchrist@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