News for hackers. Stuff that matters.
Re:Helping a Million Developers Exit Vim by throwaway2016a on Tuesday May 23, 2017 @03:24PM (#14404362)
I have written hundred+ line awk programs. For stream text editing it is excellent at what it does and it's install base is huge. Rarely do I encounter a *nix machine without it on there.
Re:Helping a Million Developers Exit Vim by throwaway7645 on Tuesday May 23, 2017 @07:50PM (#14406482)
Perl & Python are also installed on most UNIX machines I've seen. I know Perl was invented to address weaknesses with Awk. I use all 3 to some degree, but is there a reason you like Awk?
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.
Re:Helping a Million Developers Exit Vim by yjftsjthsd-h on Wednesday May 24, 2017 @12:10AM (#14407559)
> Rarely do I encounter a nix machine without it on there.

Isn't it posix mandated?

Re:Helping a Million Developers Exit Vim by throwaway2016a on Wednesday May 24, 2017 @08:19AM (#14409429)
yjftsjthsd-h, I'm curious so I looked it up but couldn't find anything. AFAIK POSIX only specifies operating system behavior and doesn't specify any actual apps but I could be wrong there. In any case, the rise of containerization has brought many nano Linux distributions that often have even fewer packages than even the most minimal distributions of years past.
Re:Helping a Million Developers Exit Vim by kccqzy on Thursday May 25, 2017 @08:56PM (#14421349)
No, actually POSIX does mandate awk to be present:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/aw...