9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: yy <yiyu.jgl@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] awk help; not plan9 matter
Date: Thu, 17 Sep 2009 14:35:27 +0200	[thread overview]
Message-ID: <a81fe9be0909170535n3bdbe47y4a5d0066df176541@mail.gmail.com> (raw)
In-Reply-To: <a560a5d00909170342o517324eegbfd83607f99a13d9@mail.gmail.com>

if you want to preserve white-space, you better forget about fields
and work with indexes on the string, match is your friend:

% echo '1      3 4           8' | awk '{match($0, /[ \t]*[^ \t]+[
\t]+/);a=RLENGTH+1;match(substr($0, a), /[ \t]/);print
substr($0,0,a-1) "hell" substr($0,RSTART+a)}'
1      hell 4           8

this is indeed a bit OT here, maybe next time you prefer trying in
#awk at freenode, where this kind of problems are welcomed

--
- yiyus || JGL . 4l77.com



  reply	other threads:[~2009-09-17 12:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17  8:23 Rudolf Sykora
2009-09-17  8:37 ` matt
2009-09-17  8:52   ` Rudolf Sykora
2009-09-17  9:04 ` matt
2009-09-17  9:12   ` Rudolf Sykora
2009-09-17 10:42     ` Rudolf Sykora
2009-09-17 12:35       ` yy [this message]
2009-09-17 12:55         ` Rudolf Sykora
2009-09-17 15:51     ` Lyndon Nerenberg - VE6BBM/VE7TFX
2009-09-17 16:02       ` erik quanstrom
2009-09-17 16:20         ` roger peppe
2009-09-17 16:55         ` Rudolf Sykora
2009-09-17 17:04           ` erik quanstrom
2009-09-17 17:10             ` erik quanstrom
2009-09-17 17:19               ` Rudolf Sykora
2009-09-17 17:34                 ` roger peppe
2009-09-17 20:33                   ` Rudolf Sykora
2009-09-17 20:46                     ` erik quanstrom
2009-09-17 21:09                       ` Rudolf Sykora
2009-09-17 21:22                         ` Rudolf Sykora
2009-09-17 21:24                         ` erik quanstrom
2009-09-17 14:16 ` Noah Evans
2009-09-17 14:45   ` roger peppe
2009-09-17 17:03   ` Rudolf Sykora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a81fe9be0909170535n3bdbe47y4a5d0066df176541@mail.gmail.com \
    --to=yiyu.jgl@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).