Merge 3 columns side by side

I know this is a stupid question for you guys!

half day googling and i got nothing :frowning:

i have 3 variables/files, say:

$X1 or file1:
# there is one whitespace space after each line
| 21
| 9
| 28
| 100
| 51

$X2 or file2:
# there is one whitespace space after each line
| disabled
| enabled
| enabled
| disabled
| enabled

$X3 or file3:
| 522 |
| 30 |
| 0 |
| 12 |
| 10 |

need output like this:
| 21 | disabled | 522 |
| 9 | enabled | 30 |
| 28 | enabled | 0 |
| 100 | disabled | 12 |
| 51 | enabled | 10 |

Help me please... Master!

The columns look bad here, i don't know how to fix it :frowning:
it should be nice with same width in each column.

you may find the attachment

You can use the paste command. Check the man page of paste.

Regards

oh ya, i'm using variable here,

sample$ paste $X1 $2 $x3

here is the result:
sample$ paste: cannot open

oh egad....

some mispelling is all...

to get things lined up nice, you could always use awk:

paste $X1 $X2 $X3 |
  awk -F\| '{ printf( "|%-7.7s|%-12.12s|%-7.7s\n", $1, $2, $3 ); }'

Hi ...

i could see in my machine..it gives correct answer..

paste -d "" 1.txt 2.txt 3.txt

output - | 21 | disabled | 522 |

Thanks
Sha

You're right guru! sorry, i was in hurry yesterday...., i'll implement this next monday in solaris system.

if those variables should redirect to files, i'll do that guru... i'll implement this also in next monday in solaris system ( but also i'll try in linux, in my machine)

Are there spaces in any of the filenames? If so:

paste "$X1" "$2" "$x3"