awk - how to merge 2 files in linux -


this question has answer here:

i have file 1:

line1 line2 line3 .... 

file 2:

date1 date2 date3 ... 

and result should be:

line1, date1 line2, date2 line3, date3 ... 

is there way on linux awk (i think) job on command line? lot

you can use awk

awk 'fnr==nr {a[nr]=$0;next} {print a[fnr]", "$0}' file1 file2 line1, date1 line2, date2 line3, date3 ...., ... 

fnr==nr {a[nr]=$0;next} when reading first file fil1, store in array a {print a[fnr]", "$0} print out array a using line number index , data file2


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -