5 ms·
Thanks. I haven't tried this, but it should actually work already in standard AWK input mode with FS and RS set to those Unicode separators. I'll test it tomorr
by benhoyt 4y ago
Thanks. I haven't tried this, but it should actually work already in standard AWK input mode with FS and RS set to those Unicode separators. I'll test it tomorrow when back at my laptop.
- benhoyt 4y agoYep, this works fine (in GoAWK, gawk, and mawk, though not in original awk): $ cat t.usv && echo id␟name␟age␞1␟Bob "Billy" Smith␟42␞2␟Jane Brown␟37 $ goawk -F␟ -vRS=␞ -vOFS=, '{ print $1, $2, $3 }' t.usv id,name,age 1,Bob "Billy" Smith,42 2,Jane Brown,37 I've also added explicit tests for ASCII and Unicode unit and record separators, just to ensure I don't regress: https://github.com/benhoyt/goawk/commit/215652de58f33630edb0c4463def18419e886ea4 https://github.com/benhoyt/goawk/commit/215652de58f33630edb0...