Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unidui!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.unix.questions Subject: Re: need AWK help: lowercase, trim trailing spaces Keywords: awk Message-ID: <1134@mwtech.UUCP> Date: 9 May 91 14:32:21 GMT References: <1817@wjvax.UUCP> <1991Apr20.075507.17530@midway.uchicago.edu> <1991Apr20.220114.8727@colorado.edu> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 24 In article <1991Apr20.220114.8727@colorado.edu> lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) writes: >To prevent printing blank lines, simply do (in awk): > > address = substr(... ) > if (length(adress) > 0) > print address Still simpler: address = substr(... ) if (address) print address Or: # assign substring to adress and print if not empty if (address = substr(... )) print address BE WARNED: I explicitly wrote a comment in front of the if statement. So don't start a discussion thread whether it is obscure, good, bad, professional or whatever programming style to write assignments within conditional contexts :-) -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83