How to format a txt file using typeset?

Hi all,

i have a file toto.txt :

blabla;toumtoudoum;blablabla
toumtoudoumtoudoum;blabla;popopopo
blablabla;etcetcetc;blabla

etc....

As you can see, it is a simple file containig 3 fields separated by a ";".

What i want to do is to display this file with a nice formating (by columns) :

blabla.............................toumtoudoum.......................blablabla
toumtoudoumtoudoum........blabla................................popopopo
blablabla.........................etcetcetc..............................blabla

etc....

(without using "....." :stuck_out_tongue: )

After a few searchs, i found that using "typeset" would be useful...but i don't know really how

any ideas?

thx

Cheers,

Howard

I used the following text for test.

cat test.file
a;a;a
b;b;b
c;c;c

awk -F";" '{printf "%s%10s%10s", $1,$2,$3}' test.file

a a a
b b b
c c c

try it.

Yeaaaaaah,

your answer was nearly the perfect solution. I rearranged it to obtain the following command line :

$ cat toto.txt | awk -F ";" '{printf "%20s %20s %20s\n", $1,$2,$3}'

ANd it works perfectly !

Thx !!! :wink:

just being inquisitive,

if you need the entire file anyway, then why cat it and then pipe it, instead directly pass it as last arg to awk, as shown by tikual

Is there some performance issue you foresee, or is it just your style

thanks!!

I guess it' my (bad?) style....

I try to do my best using the few unix commands i know.

:smiley:

And i have to admit that when i write something that works, i don't make the efforts to optimize my code....:rolleyes:

Thx for your remark! :wink: