linux 'paste' allignment problem

Hi Everyone,

[root@]# cat 1
#!/usr/bin/perl
print "c\tc\t\n";
[root@]# cat 2
#!/usr/bin/perl
print "b\tb\t\n";
print "b\tb\t\n";
print "b\tb\t\n";

[root@]# perl 1 > 11
[root@]# perl 2 > 22
[root@]# cat 11
c       c
[root@]# cat 22
b       b
b       b
b       b
[root@]# paste 11 22
c       c               b       b
        b       b
        b       b

But the output should be:

c       c               b       b
                         b       b
                         b       b

means when i paste the output into excel, the alignment can be proper aligned. how to do that? :confused:

Thanks

Y not the output can be like this ??

c       c               b       b
b       b
b       b

I mean based on what your expecting the lines 2 and 3 have to move away a bit.

Hi panyam,

please see the attached 1.png.
Thanks

In that case , you need to edit the first file , so that the second and third lines will have tabs

There is a way i thought, and it works.
for exmaple, there are three txt.

  1. use wc -l to get the max lines among those three txt.
    3 1.txt
    10 2.txt
    34 3.txt
  2. then use for loop for each file, 1.txt: 3 to 34; 2.txt: 10 to 34; 3.txt: 34 to 34, use print MYFILE "\t\t\t" to each txt.

Then paste should be no problem.

Yes , good work Done. However the no of tab's to printed is based on the column count.