learnbyexample
Interests: Regular Expressions, Linux CLI one-liners, Scripting Languages and Vim
- 113 Posts
- 75 Comments
learnbyexample@programming.devto
Open Source@lemmy.ml•What are your favourite ebook reading apps?English
5·2 months agoI use
foliateon desktop (https://johnfactotum.github.io/foliate/)
learnbyexample@programming.devto
Books@lemmy.ml•Book recommendations for a slow reader?English
10·2 months agoHow about a fast paced sci-fi novel? The Martian by Andy Weir
learnbyexample@programming.devto
Fantasy@lemmy.ml•Fantasy by female authors that appeals to male readersEnglish
4·3 months agoNot sure if these will appeal to you, but these are some of the books that I enjoyed:
- The Sword of Kaigen by M.L. Wang
- The Curse of Chalion by Lois McMaster Bujold
- Books of the Raksura by Martha Wells
- Howl’s Moving Castle by Diana Wynne Jones
- Half a Soul by Olivia Atwater
Why would it print the colon?
Regex syntax and features vary between implementations.
\disn’t supported by BRE/ERE flavors.GNU grepsupports PCRE, so you can usegrep -oP '/dev/loop\d'orgrep -o '/dev/loop[0-9]'if you are matching only one digit character.
learnbyexample@programming.devOPto
Linux@lemmy.ml•Learn GNU sed with hundreds of examples and exercisesEnglish
2·7 months agoThanks a lot for the feedback :)
learnbyexample@programming.devOPto
Linux@lemmy.ml•I wrote an ebook on GNU awk with hundreds of examples and exercisesEnglish
1·7 months agoAlready done grep, sed, coreutils, cli basics and more. See https://learnbyexample.github.io/learn_gnuawk/buy.html#book-list for links.
learnbyexample@programming.devOPto
Linux@lemmy.ml•I wrote an ebook on GNU awk with hundreds of examples and exercisesEnglish
6·8 months agoWell, if you are comfortable with Python scripts, there’s not much reason to switch to
awk. Unless perhaps you are equatingawkto Python as scripting languages instead of CLI usage (likegrep,sed,cut, etc) as my ebook focuses on. For example, if you have space separated columns of data,awk '{print $2}'will give you just the second column (no need to write a script when a simple one-liner will do). This of course also allows you to integrate with shell features (like globs).As a practical example, I use
awkto filter and process particular entries from financial data (which is in csv format). Just a case of easily arriving at a solution in a single line of code (which I then save it for future use).
learnbyexample@programming.devto
Books@lemmy.ml•Suggest me some books (Sci fi/Fantasy)English
2·9 months agoI’ll recommend some from the lesser known progression fantasy genre:
- Cradle by Will Wight
- Mage Errant by John Bierce
- Mother of Learning by Nobody103 (Domagoj Kurmaić)
- The Weirkey Chronicles by Sarah Lin
- Beware of Chicken by CasualFarmer
- Super Powereds by Drew Hayes
learnbyexample@programming.devOPto
Programming@programming.dev•Do-nothing scripting: the key to gradual automationEnglish
3·9 months agoNot my site, just sharing a link I saw on HN.
learnbyexample@programming.devto
Linux@lemmy.ml•[Solved] Convert commonmark links to Headings with spaces to GitHub flavored markdown.English
1·9 months agoWell, I’m not going to even try understanding the various features used in that
sedcommand. I do know how to use basic loops with labels, but I never bothered with all the buffer manipulation stuff. I’d rather use awk/perl/python for those cases.
learnbyexample@programming.devto
Linux@lemmy.ml•[Solved] Convert commonmark links to Headings with spaces to GitHub flavored markdown.English
2·9 months agoThis might work, but I think it is best to not tinker further if you already have a working script (especially one that you understand and can modify further if needed).
perl -pe 's/\[[^]]+\]\((?!https?)[^#]*#\K[^)]+(?=\))/lc $&=~s:%20|\d\K\.(?=\d):-:gr/ge'
learnbyexample@programming.devto
Linux@lemmy.ml•[Solved] Convert commonmark links to Headings with spaces to GitHub flavored markdown.English
1·10 months agoHmm, OP mentioned “Only edit what’s between parentheses” - don’t see anywhere that whole URL shouldn’t be changed…
learnbyexample@programming.devto
Linux@lemmy.ml•[Solved] Convert commonmark links to Headings with spaces to GitHub flavored markdown.English
2·10 months agoHere’s a solution with
perl(assuming you don’t want to change http/https after the start of(instead of start of a line):perl -pe 's/\[[^]]+\]\(\K(?!https?)[^)]+(?=\))/lc $&=~s|%20|-|gr/ge' ip.txteflag allows you to use Perl code in the substitution portion.\[[^]]+\]\(\Kmatch square brackets and use\Kto mark the start of matching portion (text before that won’t be part of$&)(?!https?)don’t match ifhttporhttpsis found[^)]+(?=\))match non)characters and assert that)is present after those characters$&=~s|%20|-|grchange%20to-for the matching portion found, therflag is used to return the modified string instead of change$&itselflcis a function to change text to lowercase
learnbyexample@programming.devto
Linux@lemmy.ml•Which Linux tool or command is surprisingly simple, powerful, and yet underrated?"English
7·10 months agoGNU datamash (https://www.gnu.org/software/datamash/alternatives/) - handy tool for data munching. There’s also https://github.com/BurntSushi/xsv
learnbyexample@programming.devto
Linux@lemmy.ml•Which Linux tool or command is surprisingly simple, powerful, and yet underrated?"English
2·10 months agoCheck out my chapter on GNU grep BRE/ERE for those wanting to learn this regex flavor: https://learnbyexample.github.io/learn_gnugrep_ripgrep/breere-regular-expressions.html (there’s also another chapter for PCRE)
learnbyexample@programming.devto
Books@lemmy.ml•Fantasy books with an interesting "soft magic" system?English
31·11 months agoMemory, Sorrow, and Thorn by Tad Williams
I use Vim ;)
Python itself provides IDLE, which is good enough for beginners. https://thonny.org/ is another good one for beginners.
As mentioned by others, Jetbrains is good for many languages. https://www.kdevelop.org/ is another option.









I use Zola (https://github.com/getzola/zola) for personal blog.
There are also other options depending on your use case. For example, https://github.com/rust-lang/mdBook for documentation/ebook style content.