3 ms·
Do you not see the horrific syntax of what you just suggested as simple?
by hueving 12y ago
Do you not see the horrific syntax of what you just suggested as simple?
- mc808 12y agoIt's pretty clear what it does. It's also C#, so building up to a less trivial task will be much less horrific than find . -type f -name '*.pgn' -print0 | xargs -0 -n4 -P4 mawk '/Result/ { split($0, a, "-"); res = substr(a[1], length(a[1]), 1); if (res == 1) white++; if (res == 0) black++; if (res == 2) draw++ } END { print white+black+draw, white, black, draw }' | mawk '{games += $1; white += $2; black += $3; draw += $4; } END { print games, white, black, draw }'
- kevin_thibedeau 12y agoIn a real production environment that command line would be put into a script parametrized with named variables and the embedded awk scripts would be changed to here-docs.
- peterhunt 12y agoAre you arguing that shell scripts scale to larger applications better than C#?
- mc808 12y agoSounds good although at that point it's just programming, and there are tools that are cleaner and faster and more robust than piping semi-structured strings around from a command line. The one real benefit that can be argued is ubiquity (on *ix). Not every system has Perl, Python, or Ruby installed - or Hadoop for that matter - but there's usually a programmable shell and some variant of the standard utilities that will get something done in a pinch. If it happens to be 200x faster than some enormous framework, so much the better.