home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: rpinder@phad.hsc.usc.edu (Rich Pinder)
-
- I have a question regarding the behavior of AWK. The following
- program successfully alters the value of one the fields as a result
- of the 'if' conditional (changes the name LEROY to Snakely).
- However, the output from the print statement seems to leave off the
- field seperators on lines that were altered, but puts them in
- correctly on others. Is this a bug with my version (SCO's 3.2)?
-
- Thanks for your help:
-
- _prog:_
-
- awk -F '|' ' {
- if ($3 == "LEROY") $3="Snakely";
- print $0 ;
- } ' $*
- _input:_
-
- 00011|CARNEY|LEROY
- 00012|CARNEY|ROBERT
- 00021|MCDONALD|ALICE
-
- _output:_
-
- 00011 CARNEY Snakely
- 00012|CARNEY|ROBERT
- 00021|MCDONALD|ALICE
-
-
- Rich Pinder
- USC School of Medicine
- (213) 342-1640
-
- rpinder@usc.edu
-
- ||||||||||||||||||||||||||||||||||||||||||||||||||
-
-
- Volume-Number: Volume 24, Number 72
-
-