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: Peng Yu
Subject: Re: Read a fixed length of input each time
Date: Tue, 23 Jun 2020 11:45:32 -0500

For example, I may do the revert processing to get back the integers
from the binary stream. For this kind of fixed binary stream, I feel
the awk syntax would be better than writing a much longer Go file.

For example, if gawk would be able to split fields based on fixed
field width and a fixed number of NF. Then, I may simply write awk
code like the following (suppose that there is a bin2uint() function).
It would be must shorter than the equivalent Go code to convert such
binary stream to integers.

$ awk -e '{ for(i=1;i<=NF;++i) { print bin2unit($i) }'

On 6/23/20, Andrew J. Schorr <aschorr@telemetry-investments.com> wrote:
> On Tue, Jun 23, 2020 at 11:38:32AM -0500, Peng Yu wrote:
>> It is to deal with binary files. For example, I may create a binary
>> stream using the following Go file.
>
> Thanks, but my question is not how you created the file. My question
> is what sort of useful processing of the binary data you plan to do
> inside gawk and how that would work. The AWK language is great for
> text, but I'm wondering why it's useful for binary data. What do
> you want to do with the binary data inside gawk?
>
> Regards,
> Andy
>


-- 
Regards,
Peng



reply via email to

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