Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your CSV peeking epiphany was in essence a matter of code vs. tools though rather than necessarily CLI vs. GUI. On Windows you might just as well have discovered you could fire up Linqpad and enter File.ReadLines("massive.csv").First() for example.


Running a shell in a GUI doesn't make it lose its "I am a CLI" property. That is a CLI.


I disagree. It's a REPL, but a REPL is not always a CLI.

(Frankly, most REPLs are smarter than shells. I go to irb way more than I do bash, these days.)


Or just use vim or any other editor smart enough not to try to slurp the whole file in one go.


Actually, mmapping the file should Just Work (tm)?


Do you not see the horrific syntax of what you just suggested as simple?


It'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 }'


In 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.


Sounds 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.


Are you arguing that shell scripts scale to larger applications better than C#?


The example was a multi-gigabyte CSV file. You just sucked the whole thing off the disk into RAM so that you could shave off the first line.

If you're unlucky, you started swapping out to disk about halfway through.


That code you're replying about was carefully and correctly written. You just replied as if you know how it works just so you could look like you know what you're talking about.

If you're unlucky, someone who actually knows how File.ReadLines() works will show up in an hour or two and explain that it's lazily evaluated.


:) touche


Wrong. ReadLines returns an IEnumerable<string> and lets you read line by line without loading the entire file into memory: http://msdn.microsoft.com/en-us/library/dd383503%28v=vs.110%....




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: