bug-gawk
[Top][All Lists]
Advanced

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

Re: Read a fixed length of input each time


From: Andrew J. Schorr
Subject: Re: Read a fixed length of input each time
Date: Tue, 23 Jun 2020 11:27:05 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Jun 23, 2020 at 09:53:57AM -0500, Neil R. Ormos wrote:
>   RS="................"
...
> Then, each getline will place chunk-size characters in RT, provided there are 
> enough characters available to match RS.  Otherwise, the residual characters 
> on the final getline resulting in reaching the end-of-file will be placed in 
> the variable specified to receive the results from getline.

That's a creative solution to the problem.

> [*1] I acknowledge the warnings from the developers and their suggestions 
> that reading binary data can best be done with an extension or some 
> pre-processing step.  But those solutions may not be available or uniform in 
> all environments where gawk is available.  So, even if this RS-based method 
> is not as good, it might allow the user to write a relatively portable 
> program intended for several heterogeneous environments.

I'll bite -- what's the benefit of reading binary data like this? What do you
do with it once you get it inside gawk? It's easy enough to add read and write
functions in an extension library, but I've never understood the usage case.
It would take maybe 15 minutes to add these functions to the select extension,
but I need a reason. And yes, as you point out, an extension is an additional
installation dependency.

Regards,
Andy



reply via email to

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