News for hackers. Stuff that matters.
Re:Helping a Million Developers Exit Vim by flukus on Wednesday May 24, 2017 @02:23AM (#14407954)
The pattern -> action format of awk is really nice for simple apps, it's a built in for loop + switch statement that reads from stdin. It's also simple to change what the record/column seperators are, so it can handle some quite complex data shapes with zero code.

Awk and python don't deal with stdin/stdout quite as nice (AFAIK) and there is always the temptation to do too much with them.

As an example, the other day I wrote a DSL in awk, it takes a mostly CSV file in and outputs sql commands. If you did it in python you could run the sql directly, but the awk stdio version makes it easier to combine as needed. If I want to run the generated sql I can pipe that to the sql cli client, if I need to hand it to QA I can just pipe to a file etc.

Re:Helping a Million Developers Exit Vim by throwaway7645 on Wednesday May 24, 2017 @06:55AM (#14409025)
Neat, will have to look into that. I think Perl might have a command line switch with similar behavior that runs your command across every line of whatever you pipe to it, but that might not be what you're saying.
Re:Helping a Million Developers Exit Vim by throwaway2016a on Wednesday May 24, 2017 @08:16AM (#14409410)
flukus, thank you. I was trying to say something like that but wasn't able to quite word it right.