Message from discussion Is this a job for awk?
Received: by 10.68.223.40 with SMTP id qr8mr15376506pbc.0.1337372578190;
Fri, 18 May 2012 13:22:58 -0700 (PDT)
From: presidentbyamendment <rick_hohen...@email.com>
Subject: Re: Is this a job for awk?
Date: Fri, 18 May 2012 13:22:57 -0700 (PDT)
X-Trace: posting.google.com 1337372578 16428 127.0.0.1 (18 May 2012 20:22:58 GMT)
NNTP-Posting-Date: Fri, 18 May 2012 20:22:58 +0000 (UTC)
Injection-Info: eh4g2000vbb.googlegroups.com; posting-host=22.214.171.124; posting-account=OcRAMAoAAAArFDHhZFYw2-58_dk-x0_f
X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Content-Type: text/plain; charset=ISO-8859-1
On May 8, 11:06=A0am, Fritz Wuehler
> Hello guys I stumbled upon awk today and it's pretty neat. I am thinking
> about an application and I don't know if it's better to write it in C or
> awk. Basically I want to scan source for certain commands and do a
> substitution like the cpp on steroids. Doing the regexp and matching for
> hits on the input text and doing the replacements is pretty easy so far b=
> I don't know how to copy lines that don't match to the output! Every line
> will either be echoed or transformed. I don't get how to copy non matchin=
> lines unless I process every line as $0 and do a bunch of if else and the=
> fall through to just writing the whole line if it doesn't match. Like I
> would do it in C. But that seems to go against awk's pattern action
> philosophy. Would that be too inefficient or is there an elegant way to
> (gr)awk this?
Awk is OK for that, but you might want ed. Or sed.