15
Looking for Complex Text Manipulation CLI tools
(programming.dev)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
If you're feeling a little old school (and some might say masochistic), you could so a similar crude parser with a perl oneliner. This would be more efficient compute wise, but it's a bit of an acquired taste readability wise:
Here
perl -nmakes perl look at each line individually,chompstrips off the trailing newline, we match for/^\s*-\s*(.*[^:\s])\s*$/(a string starting with a dash and ending with something not a colon) and append the content of the matching parenthesis to an implicitly declared array@a. Then we add anEND{}block which will be executed after all lines are parsed, where we print the array joined on,.