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: Andrew J. Schorr
Subject: Re: [bug-gawk] Read one character at a time
Date: Tue, 22 Jan 2019 16:57:16 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

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]