9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Kenji Arisawa" <arisawa@ar.aichi-u.ac.jp>
To: 9fans@cse.psu.edu
Subject: [9fans] awk
Date: Thu,  7 Nov 2002 15:46:29 +0900	[thread overview]
Message-ID: <d7e2337e18e882fc2b734291a9cc9365@ar.aichi-u.ac.jp> (raw)

I tested some awk string functions to examine if
they can handle UFT-8 code well.
The bollow is my text code:
#!/bin/rc
#
#	Can awk function handle UTF strings ?
#
echo 'ベル:研究所' | awk '{
print $0	# ベル:研究所
print length($0)	# 6
print index($0,":")	# 3
print match($0,":.*"),RSTART, RLENGTH	# 7	7 4
print substr($0,3)	# :研究所
a=$0; sub(":.+", "alice", a); print a	# ベルalice
}'

Output is commented after `#' in each line.
Function `match' returns byte position that is inconsitent
with others. I believe this is a bug.

Kenji Arisawa


             reply	other threads:[~2002-11-07  6:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-07  6:46 Kenji Arisawa [this message]
2002-11-20 14:49 ` Kenji Arisawa
  -- strict thread matches above, loose matches on Subject: below --
2003-09-13  0:40 boyd
2002-11-07  9:56 okamoto
2001-06-11 10:13 Laura Creighton
2001-06-11 12:27 ` Boyd Roberts
2001-06-18  9:12 ` Rick O'shay
2000-03-14 10:06 Arnold
2000-03-13  6:25 Bengt
2000-03-13  1:21 Vladimir
2000-03-12 23:29 bobf
2000-03-12 22:50 Scott
2000-03-12 21:50 Vladimir

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=d7e2337e18e882fc2b734291a9cc9365@ar.aichi-u.ac.jp \
    --to=arisawa@ar.aichi-u.ac.jp \
    --cc=9fans@cse.psu.edu \
    /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).