Replace sed/awk/grep/wc/... with pure & readable Ruby
Be a instant-commandline-ninja without learning new tools, e.g. number of files by date: ls -al | pru ‘split(“ “)[5]’ ‘grouped.map{|d, f| “#{d} : #{f.size}” }’ try Pipeable-Ruby (pru).
Be a instant-commandline-ninja without learning new tools, e.g. number of files by date: ls -al | pru ‘split(“ “)[5]’ ‘grouped.map{|d, f| “#{d} : #{f.size}” }’ try Pipeable-Ruby (pru).
Comments
Readable, really?
Wow, my head hurts. Better use traditional Sed/Awk/Grep. Because they are good enough.
No offense, but imo it is strong candidate to “the most stupid lib of the century” prize. imo knowledge of sed/grep is just indispensable basis for every nix programmer. Happy seding and greping :) nu7
Let’s look at this logically. grosser has created a tool that demonstrates that you can use ruby from the command line in place of grep, awk, sed, etc. and someone calls it stupid and says you need to use sed and grep, and the evidence they offer is… (drum roll)…their own opinion: “imo knowledge of sed/grep is just indispensable basis for every nix programmer”. WTF? They offer no evidence that means anything at all, they can’t even put together a grammatical sentence, and yet they call this stupid. Wow.
Then another person asserts (without the put-downs, fortunately) that it is better to use sed and awk and grep. Their reason is that these tools are “good enough”. Yeah, that’s a good standard to use. Imagine my rich uncle offered me a Maserati, but I said my Mazda was good enough and I didn’t want it. Hmmm…
Whether this is readable or not may be in the eye (and mind) of the beholder. It might have been helpful to have a version using traditional Unix tools to compare the
pru
version with, as well as a version usingruby -e
. Then it would be easier to evaluate whether or not this is readable.Post a comment