"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.
They are available at http://mcollado.z15.es/xgawk/.
Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are
welcome.
The goal of csvio is to process CSV records as if they were regular awk records, delimited by some FS/OFS or your choice.
HTH. Enjoy.
Hi Manuel,
thanks for this interesting information and for providing the library!
Since I currently don't have any XML projects and don't know whether
I'll find time for a thorough examination, one question ahead...
Does that library work similarly/exactly like xgawk's implementation
or are there some or substantial differences?
I am asking because I basically considered the xgawk concept as very
good, but I recall to have found (at that time) some strange behavior
(with blanks and RS, IIRC, but I have only faint memories after these
many year).
Janis
On 27.04.2023 13:13, Manuel Collado wrote:
"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.
They are available at http://mcollado.z15.es/xgawk/.
Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are
welcome.
The goal of csvio is to process CSV records as if they were regular awk
records, delimited by some FS/OFS or your choice.
HTH. Enjoy.
I'm afraid there is some misunderstanding. The announced csvio library supports CVS files, not XML ones.
Re-posted - URL changed.Manuel, Thank you for the Library Code. I tested it on a number of different CSV and TSV files and see no errors or bugs.
"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.
They are available at http://mcollado.z15.es/gawk-extras/.
Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are welcome.
The goal of csvio is to process CSV records as if they were regular awk records, delimited by some FS/OFS or your choice.
HTH. Enjoy.
--
Manuel Collado - http://mcollado.z15.es
Manuel, Thank you for the Library Code. I tested it on a number of different CSV and TSV files and see no errors or bugs.
I would like to share something I learned the hard way: I use
RS = @/[\n\f\r]+/ # \f weirdness in the middle of some Fidelity Brokerage Download CSVs AND LF only (no \r) in some TSVs, etc.
I am not 100% sure, but I think you might add the # Strip unwanted CRs to include \f (unwanted!) also.
'Best, John Naman
Re-posted - URL changed.
"csvio.awk" is a pure awk library that provides CSV support for awk. It
is available in two variants. "gawk-csvio" uses some specific gawk
features. "awk-csvio" uses only POSIX awk features.
They are available at http://mcollado.z15.es/gawk-extras/.
Version 0.x.x is intended as a preliminary issue, mostly to get feedback
from interested users. Suggestions, comments, bug reports, etc. are
welcome.
The goal of csvio is to process CSV records as if they were regular awk records, delimited by some FS/OFS or your choice.
HTH. Enjoy.
[...]
3) The for loop in csvimport()
The statements
for (k=1; k in af; k++) {
fk = af[k]
can be replaced with the single statement
for (fk in af) {
[...]
On 28.04.2023 11:44, Bruce Horrocks wrote:
[...]
3) The for loop in csvimport()
The statements
for (k=1; k in af; k++) {
fk = af[k]
can be replaced with the single statement
for (fk in af) {
I don't know the context, so I cannot tell whether a sequential
indexed traversal (as in the first for-loop) is neccessary or not.
The second for-loop wouldn't guarantee a traversal ordered by the
numerical index.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 498 |
Nodes: | 16 (2 / 14) |
Uptime: | 12:50:38 |
Calls: | 9,822 |
Calls today: | 1 |
Files: | 13,759 |
Messages: | 6,190,952 |