Alex
Alex

Reputation: 357

Paste - empty columns

I want to paste columns of three files. The middle files has one line empty. How to set the "tab" in this place?

file1

B 
B
B

file2

58399.9865 58468.6631 58434.3248

56972.1692 56975.0525 56973.6108

file3

22452
29000
1165

paste file1 file2 file3 > desired_result

output:

B   58399.9865 58468.6631 58434.3248    22452
B       29000
B   56972.1692 56975.0525 56973.6108    1165

29000 is from the last file in paste command and I would like to align it with 22452 and 1165

Desired output:

B   58399.9865 58468.6631 58434.3248    22452
B                                       29000
B   56972.1692 56975.0525 56973.6108    1165

OUTPUT after advise:

B  58399.9865 58468.6631 58434.3248  22452
B  29000
B  56972.1692 56975.0525 56973.6108  1165

Upvotes: 1

Views: 208

Answers (1)

Arkadiusz Drabczyk
Arkadiusz Drabczyk

Reputation: 12548

$  paste file* | column -s "$(printf '\t')" -t
B  58399.9865 58468.6631 58434.3248  22452
B                                    29000
B  56972.1692 56975.0525 56973.6108  1165

Upvotes: 1

Related Questions