bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Read one character at a time


From: arnold
Subject: Re: [bug-gawk] Read one character at a time
Date: Wed, 23 Jan 2019 00:03:49 -0700
User-agent: Heirloom mailx 12.5 7/5/10

If you wish to read one character at a time in "raw" mode like
screen editors do, then there is no way, short of writing an
extension.

Otherwise, Andy's solution works.

Arnold

"Andrew J. Schorr" <address@hidden> wrote:

> On Tue, Jan 22, 2019 at 03:15:18PM -0600, Peng Yu wrote:
> > I'd like to read one character at a time (include newline). Reading a
> > line and split it into characters is not what I need.
> > 
> > I am yet to find a way to read character by character. Is it possible with 
> > gawk?
>
> There may be a better solution, but here's one that puts each character
> into the RT variable:
>
> bash-4.2$ echo 'abc
> > def' | gawk -v 'RS=.{1}' '{printf "[%s]\n", RT}'
> [a]
> [b]
> [c]
> [
> ]
> [d]
> [e]
> [f]
> [
> ]
>
> But perhaps I misunderstood your question, since I can't see why this
> would be useful.
>
> Regards,
> Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]