Bash: combine 2 files, arrange in row, and add equal to sign all in one step

advertisements

I have two files that list output in the following format:

File1

line1
line2
line3

File2

20%
30%
40%

How can I achieve this format below (single row)from the 2 original files and have this in a new file all in one step?

line1=20% line2=30% line3=40%


Amending @gniourf_gniourf's suggestion: Given the two files you call:

paste -d= file1 file2| tr '\n' ' '

which first creates

  1. newline separated pairs from file1 and file2 same line entries
  2. joined by = and then
  3. in the pipe tr(anslate) replaces every newline character \n with a single space

... if a pipe qualifies as "in one step".