1

I have problem that numbers from different files are not in one line.

I tried:

 paste file1 file2 file3|awk '{print $1, $2, $6, $10}'

file1:

a b c

file2:

d e f

file3:

g h i

output is:

a b
e
h

Desired output:

a b e h

it is columns 1 2 from file1, column 2 from file2 and column 2 from file3

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Elisabeth
  • 333
  • 2
  • 7
  • What is the logic to print `a b e h`? just random? or first 2 columns from 1st file and 2nd column from the other two files – Inian Aug 22 '19 at 08:12
  • Yes I want to print columns $1 $2 from file1 and column $2 from file2 and file3. – Elisabeth Aug 22 '19 at 08:14

1 Answers1

1

I suggest first to fix end of line in your files:

dos2unix file1 file2 file3
Cyrus
  • 84,225
  • 14
  • 89
  • 153