home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.24 / text0071.txt < prev    next >
Encoding:
Text File  |  1991-09-03  |  872 b   |  42 lines

  1. Submitted-by: rpinder@phad.hsc.usc.edu (Rich Pinder)
  2.  
  3. I have a question regarding the behavior of AWK.  The following
  4. program successfully alters the value of one the fields as a result
  5. of the 'if' conditional (changes the name LEROY to Snakely).
  6. However, the output from the print statement seems to leave off the
  7. field seperators on lines that were altered, but puts them in
  8. correctly on others.  Is this a bug with my version (SCO's 3.2)?
  9.  
  10. Thanks for your help:
  11.  
  12. _prog:_
  13.  
  14. awk -F '|' ' {
  15.      if ($3 == "LEROY") $3="Snakely";
  16.          print $0  ; 
  17.         } ' $*
  18. _input:_
  19.  
  20. 00011|CARNEY|LEROY
  21. 00012|CARNEY|ROBERT
  22. 00021|MCDONALD|ALICE
  23.  
  24. _output:_
  25.  
  26. 00011 CARNEY Snakely
  27. 00012|CARNEY|ROBERT
  28. 00021|MCDONALD|ALICE
  29.  
  30.  
  31.         Rich Pinder
  32.         USC School of Medicine
  33.         (213) 342-1640
  34.  
  35.         rpinder@usc.edu
  36.  
  37.     ||||||||||||||||||||||||||||||||||||||||||||||||||
  38.  
  39.  
  40. Volume-Number: Volume 24, Number 72
  41.  
  42.