Print text files side by side
Print text files side by side
am 09.10.2007 21:11:18 von mahurshi
Is there a quick and easy way to print files side by side ?
for e.g. )
file1
1
2 3aaaadf
4 5
file2
a
bc
de
f
g
output
1 a
2 3aaaadf bc
4 5 de
f
g
i tried to show all possible input cases in this example, such as one
file being longer than the other, the lines having different lengths,
etc. i do not mind if there is a delimiter between the contents. it
would be nice to have the stuff print side by side.
Re: Print text files side by side
am 09.10.2007 21:30:05 von cichomitiko
Mahurshi Akilla wrote:
> Is there a quick and easy way to print files side by side ?
>
>
> for e.g. )
>
> file1
>
> 1
> 2 3aaaadf
> 4 5
>
> file2
> a
> bc
> de
> f
> g
>
>
> output
>
> 1 a
> 2 3aaaadf bc
> 4 5 de
> f
> g
>
[...]
paste file1 file2
Dimitre
Re: Print text files side by side
am 09.10.2007 21:31:31 von Steven J Masta
Mahurshi Akilla wrote:
> Is there a quick and easy way to print files side by side ?
>
>
> for e.g. )
>
> file1
>
> 1
> 2 3aaaadf
> 4 5
>
> file2
> a
> bc
> de
> f
> g
>
>
> output
>
> 1 a
> 2 3aaaadf bc
> 4 5 de
> f
> g
>
> i tried to show all possible input cases in this example, such as one
> file being longer than the other, the lines having different lengths,
> etc. i do not mind if there is a delimiter between the contents. it
> would be nice to have the stuff print side by side.
The pr command might be what you want with the -m option and probably -t
Steve
Re: Print text files side by side
am 09.10.2007 21:34:10 von Cyrus Kriticos
Mahurshi Akilla wrote:
> Is there a quick and easy way to print files side by side ?
>
>
> for e.g. )
>
> file1
>
> 1
> 2 3aaaadf
> 4 5
>
> file2
> a
> bc
> de
> f
> g
>
>
> output
>
> 1 a
> 2 3aaaadf bc
> 4 5 de
> f
> g
[bash]
$ paste file1.txt <(sed "s/^/\t/" file2.txt)
output:
1 a
2 3aaaadf bc
4 5 de
f
g
--
Best regards | "The only way to really learn scripting is to write
Cyrus | scripts." -- Advanced Bash-Scripting Guide
Re: Print text files side by side
am 09.10.2007 21:37:19 von Cyrus Kriticos
Steven J Masta wrote:
>
> The pr command might be what you want with the -m option and probably -t
very nice solution
--
Best regards | "The only way to really learn scripting is to write
Cyrus | scripts." -- Advanced Bash-Scripting Guide
Re: Print text files side by side
am 09.10.2007 22:07:04 von mahurshi
On Oct 9, 12:31 pm, Steven J Masta wrote:
> Mahurshi Akilla wrote:
> > Is there a quick and easy way to print files side by side ?
>
> > for e.g. )
>
> > file1
>
> > 1
> > 2 3aaaadf
> > 4 5
>
> > file2
> > a
> > bc
> > de
> > f
> > g
>
> > output
>
> > 1 a
> > 2 3aaaadf bc
> > 4 5 de
> > f
> > g
>
> > i tried to show all possible input cases in this example, such as one
> > file being longer than the other, the lines having different lengths,
> > etc. i do not mind if there is a delimiter between the contents. it
> > would be nice to have the stuff print side by side.
>
> The pr command might be what you want with the -m option and probably -t
>
> Steve- Hide quoted text -
>
> - Show quoted text -
Wow! This works great! Thanks.