home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!darwin.sura.net!convex!constellation!munnari.oz.au!mel.dit.csiro.au!yarra!pta!bob
- From: bob@pta.pyramid.com.au (Robert Vernon)
- Newsgroups: comp.unix.questions
- Subject: Re: Strange behavior with paste command
- Message-ID: <1992Jul30.095231.20774@pta.pyramid.com.au>
- Date: 30 Jul 92 09:52:31 GMT
- References: <1992Jul27.141928.28250@news.acns.nwu.edu> <1992Jul27.153536.12371@ddsw1.mcs.com>
- Organization: Pyramid Technology Corporation, Sydney
- Lines: 45
-
- In article <1992Jul27.153536.12371@ddsw1.mcs.com> dattier@ddsw1.mcs.com (David W. Tamkin) writes:
- >navarra@casbah.acns.nwu.edu (John Navarra) wrote in
- ><1992Jul27.141928.28250@news.acns.nwu.edu>:
- >
- >| I don't get this! Why does the following happen with the paste command:
- >|
- >| $ paste file1 file2 file3 > file.results
- >| $ cat file.results
-
- [ output deleted ]
-
- >| What's up with the last line? Is there some way to make this print
- >| out right?
- >
- >Since none of your entries are wider than twelve characters, you can fix it
- >for this particular case by setting your tabstops fourteen or more columns
- >apart. I know of no general solution.
-
- $ nawk '{getline col1 < "file1"
- getline col2 < "file2"
- col3=$0
- printf "%-16s%-16s%-16s\n",col1,col2,col3}' file3 > file.results
- $ cat file.results
- lsr005-1.wav 5.050659E-03 8.773804E-03
- lsr005-2.wav 9.506226E-03 1.493835E-02
- lsr005-3.wav .0128479 1.991272E-02
- lsr005-4.wav 1.850891E-02 .0272522
- lsr005-5.wav 2.275085E-02 3.291321E-02
- lsr025-1.wav 4.780579E-02 6.880188E-02
- lsr025-2.wav 6.732178E-02 9.716797E-02
- lsr025-3.wav 9.461975E-02 .1350403
- lsr025-4.wav .1144867 .163559
- lsr025-5.wav .1334534 .1909943
- lsr1-1.wav .3167419 .4694824
- lsr1-2.wav .5150909 .739624
- lsr1-3.wav .7581482 .9957733
- lsr1-4.wav 1.062622 1.255859
- lsr1-5.wav 1.37088 1.504074
-
- I guess this is still not general purpose. It only works with exactly
- 3 files and it won't work properly if the files are different
- lengths.
-
-
- Bob V!
-