home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / question / 9631 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  2.0 KB

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