From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,3a88a2329cf02d52 X-Google-Attributes: gidfee84,public From: stuart@nsl-too.pa.dec.com (Stephen Stuart) Subject: Re: Korn shell programming - awk in particular Date: 1997/04/25 Message-ID: <5jp6s6$s7l@usenet.pa.dec.com>#1/1 X-Deja-AN: 237175450 Distribution: world References: <5jodsm$df4$1@sue.cc.uregina.ca> Organization: Digital Equipment Corporation, Palo Alto, CA, USA Newsgroups: comp.unix.osf.osf1 : 1) Is there any good book that will teach me shell programming : using the Korn shell? http://www.amazon.com/ Do a subject search on "korn shell programming". : 2) How do I debug this awk problem? : $ x = "this+is+a+line+with+equals" : : I am trying to replace all the + characters with spaces. : $ print $x | awk '{ i=gsub("+","",$0) }' : "@awk: There is a regular expression error. : *?+ not preceded by valid expression : The source line number is 1. : The error context is : { i=gsub("+","",$0) >>> <<< "+" is a special character in regular expressions. You need to quote it to have it treated literally: print $x | awk '{ i=gsub("\\+"," ",$0) }' or print $x | awk '{ i=gsub("[+]"," ",$0) }' Stephen - ----- Stephen Stuart stuart@pa.dec.com Network Systems Laboratory Digital Equipment Corporation