Re: awk fields
- From: Aragorn <aragorn@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 02 Sep 2010 08:06:14 +0200
On Wednesday 01 September 2010 22:32 in comp.unix.shell, somebody
identifying as Janis Papanagnou wrote...
Am 30.08.2010 19:06, schrieb Ed Morton:
On 8/30/2010 10:59 AM, Seebs wrote:
On 2010-08-30, contracer<contracer11@xxxxxxxxx> wrote:
cat tapes.lis | awk ' { if ($15=8) { print $0 }}'
This seems gratuitously complicated. Try:
awk '$15 = 8'
Unlike shell, "=" is an assignment, "==" is a test:
Sorry to nit-pick. As in shell, "=" is an assignment.
"==" is also the equality test in modern shells, in
addition to the old "=", which may even be deprecated
(as in Kornshell).
You may consider it deprecated - and in all fairness, so do I - but a
single "=" as an equality test is still the official POSIX standard,
while "==" is not. ;-)
GNU Bash supports both "=" and "==" as equality tests, by the way.
Don't know about the Korn Shell or the C Shell as I use neither.
--
*Aragorn*
(registered GNU/Linux user #223157)
.
- Follow-Ups:
- Re: awk fields
- From: Janis Papanagnou
- Re: awk fields
- References:
- Re: awk fields
- From: Janis Papanagnou
- Re: awk fields
- Prev by Date: Re: repeating a character a variable number of times
- Next by Date: Re: Weirdest shell behavior ever...
- Previous by thread: Re: awk fields
- Next by thread: Re: awk fields
- Index(es):
Relevant Pages
|