Hacker News new | ask | show | jobs
by lighthawk 3892 days ago
This is the sort of thing a combination of bash/grep/awk/sed is good for also.
2 comments

True, but if you write Ruby all day and are most familiar with it, a script like this takes a matter of minutes to write compared to trawling the man pages of grep/awk/sed to implement the same thing you're only going to throw away after execution anyway.
After you are familiar with the shell tools, it takes seconds to write something like this, not minutes.
Sure if you control the environment and can install Ruby. grep/sed/awk are always installed.
Presumably, if you write ruby all day, there is a good chance that the environments you encounter have ruby installed, as well (and they might be even be Windows environments, in which case grep/sed/awk are not "always installed.")
Portability becomes a problem though. GNU vs BSD sed/grep :(
They do have a shared subset of features defined by POSIX. It's limiting and takes discipline, but it's not really impractical.
whatever gets the job done faster. if you treat it like throw-away it does not really matter.