John Bartley K7AAY <address@hidden> wrote...
awk 'ORS=%NR%1?",":"\t"' %1.tsv > %1.csv
Aside from the typo (not your fault), NR%1 is an error. NR will only
evaluate to integer values, so NR%1 will ALWAYS evaluate to 0, so the
ternary expression NR%1?",":"\t" would ALWAYS evaluate to "\t".
This line of code, . . .
fails for me while running GNUWIN32 gawk 3.1.0 and I would
appreciate guidance from y'all in finding a fix.
CMD doesn't understand single quotes, and the only versions of gawk
that rebuild Unix shell-like command lines are 16-bit versions
compiled with DJGPP which may cause problems with long filenames.
Also, if you mean the following 1-liner from the linked article,
# concatenate every 5 lines of input, using a comma separator
# between fields
awk 'ORS=%NR%5?",":"\n"' file
then it's got a typo. It should be
awk 'ORS=NR%5?",":"\n"' file
but that still requires Unix shell-like quote processing.
I am trying to take a three line file and turn it into a one-line,
tab-separated file, so I can (later on) concatenate multiple files
into one CSV for import into Excel.
Do you mean you want a file containing
and you're going to be doing this in a CMD batch file? If so, you
should use something like
awk "ORS=NR%3?tab:nl" tab=\t nl=\n %1.tsv > %1.csv