My god, this super useful when you have a mix o shell commands and processing text output from them. Bash isn’t particularly easy to work with parsing non-trivial strings in a readable way (I’m looking at you awk)
This is why Perl and regular expressions have been so popular on Unix and Linux systems for the past 30 years or so.
Python and Ruby are also very handy for these kinds of tasks.
People joke about regular expressions being another problem to solve, but they really are an elegant solution to handle a LARGE portion of text processing needs.
I apologize, but I must disagree. Awk is literally amazing once you get used to writing actual scripts instead of trying for the ever-elusive and often-untenable one-liners.
Noone is using `python -c` syntax for constructing one-liners and i think thats helping adoption of python. I have no idea why one-liners are seen as desirable when they're often hard to read and debug.
When I first was getting into coding while doing test engineering, this was one of my greatest complaints. The software engineers would hand me bash scripts filled with very clever, but unexplained and esoteric one-liners.
Whenever something didn't work (and it didn't, because perfectly interfacing with embedded hardware is tough), I had two options: spend literal hours on Google and Stack Overflow, or go stand outside their cubicle and hope they had time for me.
I'll take a verbose function with clearly-followable logic over an amazing one-liner with a maze of options and hacks any day.
Python and Ruby are also very handy for these kinds of tasks.
People joke about regular expressions being another problem to solve, but they really are an elegant solution to handle a LARGE portion of text processing needs.