News for hackers. Stuff that matters.
Re:GoAWK: an AWK interpreter written in Go by helper on Saturday August 18, 2018 @12:12AM (#17786824)
Ha. I was just thinking how useful it would be to have the awk programming language available in a tool that natively understood csv files. Suddenly that seems a lot more doable!
Re:GoAWK: an AWK interpreter written in Go by benhoyt on Saturday August 18, 2018 @09:56AM (#17788471)
Interesting point. I've though that AWK should have a mode where it does proper quote parsing of CSV files. Maybe I'll add a -csv option for that (or just have it do it automatically when the FS is ',' -- though that wouldn't be backwards compatible).
Re:GoAWK: an AWK interpreter written in Go by vram22 on Saturday August 18, 2018 @03:04PM (#17790037)
You probably know it already, but in case not, the CSV format is not fully standardized, and so there are variations. So you might have to handle those to provide better support of the feature, if you implement it.

https://en.wikipedia.org/wiki/Comma-separated_values

For example, csv.reader in Python's csv module in the stdlib, has a dialect argument, due to this.

https://docs.python.org/2/library/csv.html

https://docs.python.org/3/library/csv.html

Re:GoAWK: an AWK interpreter written in Go by jrumbut on Saturday August 18, 2018 @11:12PM (#17792355)
Perhaps deal with quotes strings generally, and then quoted strings mode with FS=, is CSV mode, and that quoted string functionality is available elsewhere (and maybe also for output).

Less intuitive maybe for beginners but more generally useful?

Re:GoAWK: an AWK interpreter written in Go by helper on Saturday August 18, 2018 @11:35AM (#17788940)
If you add a -csv I would use it!
Re:GoAWK: an AWK interpreter written in Go by dbro on Saturday August 18, 2018 @12:49AM (#17786921)
You might want to check out https://github.com/dbro/csvquote which helps awl and other text tools handle csv files which have quoted strings as values.
Re:GoAWK: an AWK interpreter written in Go by helper on Saturday August 18, 2018 @11:28AM (#17788904)
If I'm going to preprocess before invoking awk I think I'd rather switch the separators to use ascii record/unit separator values than to replace the content of the actual fields.