[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] The best way to test the first n character in a file
From: |
Peng Yu |
Subject: |
Re: [bug-gawk] The best way to test the first n character in a file |
Date: |
Thu, 19 Sep 2019 09:15:41 -0500 |
So far the most succinct why that I found is this.
echo {a..z} | awk 'BEGIN { FIELDWIDTHS=3} { print $1 }'
On Wed, Sep 18, 2019 at 11:35 AM Peng Yu <address@hidden> wrote:
>
> Hi,
>
> I want to test if the first n character of a binary file equals some
> given string. I am not sure if awk is good at this. It seems that
> `head` plus shell code should be easier. Is there a good way to do so
> in awk? Thanks.
>
> --
> Regards,
> Peng
--
Regards,
Peng