Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Bob Vickers <bobv@dcs.rhbnc.ac.uk>
To: "A. Mahendra Rajah" <MAHENDRA@Meena.CC.URegina.CA>
Subject: Re: Korn shell programming - awk in particular
Date: 1997/04/25	[thread overview]
Message-ID: <33607ADA.41C6@dcs.rhbnc.ac.uk> (raw)
In-Reply-To: 5jodsm$df4$1@sue.cc.uregina.ca



A. Mahendra Rajah wrote:
> 

> 
>    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) >>>   <<<
> 

You can do this at shell level:
	$ x="this+is+a+line+with+equals"
	$ y=`echo $x | tr '+' ' '`

If you can I would avoid awk. In my opinion (flames to /dev/null please)
it is hideous, and it is pretty unportable (all versions have different
quirks). You are better off learning ksh or Perl.

Bob
-- 
======================================================================
Bob Vickers			R.Vickers@rhbnc.ac.uk
Dept of Computer Science, Royal Holloway College, University of London
WWW:	http://www.dcs.rhbnc.ac.uk/%7Ebobv/
Phone:	+44 1784 443691



  parent reply	other threads:[~1997-04-25  4:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-24  4:00 Korn shell programming - awk in particular A. Mahendra Rajah
1997-04-25  4:00 ` Stephen Stuart
1997-04-25  4:00 ` Bob Vickers [this message]
1997-04-25  4:00 ` Finnbarr P. Murphy
1997-04-25  4:00 ` Pasqualino Caccavelli
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox