need AWK help: lowercase, trim trailing spaces

Martin Weitzel martin at mwtech.UUCP
Fri May 10 00:32:21 AEST 1991


In article <1991Apr20.220114.8727 at colorado.edu> lewis at 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 at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.unix.questions mailing list