-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically changing RS #143
Comments
Interesting, thanks for the report! This is a tricky one. It seems that GNU Gawk (and other AWKs) allow you to set I can reproduce your case if I save your input file to
However, that program doesn't work in
To work around this in GoAWK for now, I'd recommend actually reading (part of) the file twice. Note how
That said, I think this is a bug (or at least a quirk) of GoAWK, so I'm going to leave it open. I'm not sure the best way to fix it without revamping the use of |
@arnoldrobbins, any thoughts on this? Where is this behaviour (that one can change |
It's just assumed it will work. |
I think what I'll do here (at some point) is copy the |
I remember this fun example in the Gawk book that uses RS+print to implement sed-like find-and-replace - the RS is updated in every cycle of the implicit loop while reading the input. The idea is credited to Mike Brennan, so probably it's portable to mawk at minimum. |
Actually, at the moment, only |
Oh, I missed that! Also, I just read the page again and |
I've got a file where the first few bites define some of the attributes of the file. The 9th bite is the record separator.
I need to read this file, set
RS
and then read the file "again" but now separated by this new record separator.Input file (here the record separator is
'
):This works on GNU awk:
output:
but not on goawk:
The text was updated successfully, but these errors were encountered: