home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / editors / 2032 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  853 b 

  1. From: kevinl@tisdec.tis.tandy.com
  2. Date: 18 Aug 92 09:08 CDT
  3. Newsgroups: comp.editors
  4. Subject: Re: Switching cols in VI
  5. Message-ID: <4900001@tisdec.tis.tandy.com>
  6. Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!sdd.hp.com!usc!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!seas.smu.edu!utacfd.uta.edu!trsvax!trsvax!tisdec.tis.tandy.com!kevinl
  7. Nf-ID: #N:tisdec.tis.tandy.com:4900001:000:361
  8. Nf-From: tisdec.tis.tandy.com!kevinl    Aug 18 09:08:00 1992
  9. Lines: 19
  10.  
  11.  
  12.     If you don't want to worry about how many columns you have,
  13. you can use the following awk program.
  14.  
  15.  
  16. {
  17.     for( i = 0; i < NF; i++ ) {
  18.         printf "%s", $(NF - i)
  19.         if( i != NF - 1 )
  20.             printf " "
  21.     }
  22.     print ""
  23.  
  24. }
  25.  
  26. It just starts at the end and works backwards.  The 'if' is there
  27. so that it doesn't put spaces at the end of your lines.  Hope this
  28. helps you out. 8-)
  29.  
  30.