8 ms·
I had the exact same experience, but sub python for Ruby. The lesson I took wasn't that awk sucks, though. The lesson was that CSV is not trivial, and should n
by billjings 7y ago
I had the exact same experience, but sub python for Ruby.
The lesson I took wasn't that awk sucks, though. The lesson was that CSV is not trivial, and should not be parsed with regex or string matching. It's a standard with variants, and rolling in a library will pay dividends, especially if you're parsing a wide variety of different dialects of CSV.
A related lesson I took is that once your awk script grows beyond a certain level, graduate it up to a real language. I love awk, but it excels at small scale text munging. It's not suited to anything more involved than that. If translating an awk program is a major task, then the program was already too big to begin with.