I have two files:file1 contains:1234file2 contains:JohnSamGeorgeKenI want to combine these files to create one file(file3)1, John2, Sam3, George4, KenMy thought was to use nested loops and add the comma for each line,for x in file1doecho $x >> file3for y in file2echo ,$y >> file3donedoneIs there a command I need to use? How do I get it to x and y to appear on one line for each entry in both files?
How to combine two files into one with columns for each file's data?
shell script
You can use paste:$ :|paste -d',' file1 - | paste -d' ' - file21, John2, Sam3, George4, Kenor:$ :|paste -d', ' file1 - file2