5 ms·
The reason I chose that particular example was not for the database integration (which is very cool) but for the fact that it's actually something I did. Point
by PeCaN 10y ago
The reason I chose that particular example was not for the database integration (which is very cool) but for the fact that it's actually something I did.
Point is, imagine trying to grep anything tabular in bash. Hypothetically, the output of ls -la for files with execute permission that have been modified in the last day. Or, more realistically, anything involving ps.
- daveloyall 10y agoImagine trying? Sir/Ma'am, I have done so. When boxed in-between the fearsome foursome--`bash`, `sed`, `awk`, and `emacs`--every problem involving tabular data (2D) is trivial. Hm, I'll give a shout-out to `sort` and `uniq`, too! When you go 3D, you might need to bring in `join`. But anyway, you'd use find ~/bin /usr/bin -mtime 1 -executable -type f -ls ..to provide `ls -la` output for every executable, ordinary files (not directories, which are often +x) modified in the last 24 hours, under the directories /usr/bin or the bin/ under your home directory. :)
- qwertyuiop924 10y agoHey, don't forget cut and xargs!
- daveloyall 10y ago*gulp* I've heard people say that, but I haven't delved into them!! :-S
- qwertyuiop924 10y agocut doesn't match awk, but it's handy for the little stuff. And xargs is the most usefull thing ever.
- grkvlt 10y agoAnd paste for tasks requiring the opposite of cut, then there's tr, the lightweight sed. And jq for structured queries on JSON. But, all these are built in to poweshell, essentially.
- qwertyuiop924 10y agoNo they're not. PS can't process text all that well...
- KirinDave 10y agoMost users do not find awk trivial. Most people basically use it for {print $colnum} when simple columns are available. PowerShell's integrated query syntax that you can patch into various things is a lot more consistent and reasonable. It is difficult to imagine volunteering people into a world of awk, sed and cut with good intentions in one's heart.
- daveloyall 10y agoI didn't call awk trivial, I meant to say that the prudent application of powerful tools makes quick work of otherwise intractable problems. Forgive my being frank, please, but I think that given the context of this conversation, it's appropriate: Most users don't HAVE non-trivial problems! There aren't features in sed nor awk, nor regular expressions in general that weren't put there for some specific reason in the past. When you wield your shell, well, you wield a tool honed through the ages by people who think like you! Do so with pride! :)
- KirinDave 10y agoI have no time for tool worship, language worship, and other sentiment like that. These are tools, not people. I'll use the best I can buy, borrow, or make until I see another better one comes along.
- daveloyall 10y agoA corporation has no incentive to give you (let you keep forever) the best possible tools.
- KirinDave 10y agoIf that is true, then it is equally true of the authors of shells. But of course, it's not true. Many great and lasting tools have been founded out of corporate work in a bid to improve mindshare and ease recruiting by increasing the esteem of corporate engineering efforts. Many of the things we think of as "open source" and "free" were built subsidized either directly or indirectly by capitalistic interest. But I'm not concerned about keeping it. Ossifying my process so that I can give myself the luxury of time of from learning is not something I'm prepared to do, because I think it will make me soft and less capable as an engineer. I regularly rotate my editors and learn new languages because I don't want to become like the sad specters of the previous generation of software engineers I see now, starched shirts and ties and a fanatical devotion to the dated technologies they stomach in order to collect huge consulting fees from corporations. I've switched off Fish to Powershell as my primary shell for awhile. It's interesting.