[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Read a fixed length of input each time
From: |
arnold |
Subject: |
Re: Read a fixed length of input each time |
Date: |
Tue, 23 Jun 2020 01:27:18 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Hi.
Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> I'd like to read a binary in chunks of in bytes.
Using gawk to read binary data is not recommended. It's a tool
for processing textual data. You may want to preprocess the
binary using C (or perl) into text records that gawk can process.
> awk by default uses
> RS to split the input as records. Is there a way to split the input in
> chunks with fixed length instead of using a deliminator? Thanks.
There is no way to do this built-in to gawk. I've thought about it in
the past but never implemented anything. Nor am I likely to do so
in the future.
It is fairly easy to write a C extension that would do this.
> PS. I see the following. But I am not sure if it is appropriate for my
> specific question.
>
> https://www.gnu.org/software/gawk/manual/html_node/Fixed-width-data.html
Likely it is not. It's intended for proessing columnar data, but in
regular, line-oriented records.
Arnold
- Read a fixed length of input each time, Peng Yu, 2020/06/22
- Re: Read a fixed length of input each time,
arnold <=
- Re: Read a fixed length of input each time, Neil R. Ormos, 2020/06/23
- Re: Read a fixed length of input each time, Andrew J. Schorr, 2020/06/23
- Re: Read a fixed length of input each time, Peng Yu, 2020/06/23
- Re: Read a fixed length of input each time, Andrew J. Schorr, 2020/06/23
- Re: Read a fixed length of input each time, Peng Yu, 2020/06/23
- Re: Read a fixed length of input each time, Andrew J. Schorr, 2020/06/23
- Re: Read a fixed length of input each time, Peng Yu, 2020/06/23
- RE: Read a fixed length of input each time, Tom Gray, 2020/06/23
- Re: Read a fixed length of input each time, Neil R. Ormos, 2020/06/23