How to read many input files in AWK? -


this question has answer here:

i try understand how read many input files in awk puzzle "how can print 1st column file 1 , 2nd column file 2?

input

$ cat test1  1   4 2   5 3   6 $ cat test2   b c   d    e   f 

goal

$ awk **answer** 1   b 2   d 3   f 

awk 'nr==fnr{a[nr]=$1;next} {print a[fnr], $2}' file1 file2 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -