HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
learnbyexample
Command-line-text-processing
Shell2017–2022
learnbyexample / Command-line-text-processing · Archived

Command-line-text-processing

:zap: From finding text to search and replace, from sorting to beautifying text and more :art:

12Distinct people
34Mentions
0Explicit recommenders
10.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

:zap: From finding text to search and replace, from sorting to beautifying text and more :art:

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 11:56:56 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year34 dated mentions

Observed mentions: 2017-04-08 07:21:17 UTC to 2022-10-27 15:50:31 UTC.

02468102017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 5 mentions; 4 submissions, 1 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 8 mentions; 4 submissions, 4 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 9 mentions; 0 submissions, 9 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 8 mentions; 1 submissions, 7 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2022

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC541
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC844
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC909
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC817
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC312

What Hacker News says

34 sources
I had a similar experience with one of my GitHub repos [0] that is currently 9k+ stars. I added donation link when it was about 5k stars (after it went viral courtesy HN). But this was before GitHub sponsors. I removed donation links after I got only a single donation in about a year. I had much better results when I started converting my tutorials into ebooks and sold them. Obviously having a paid product is different, but I'm referring to the paid sales I got whenever I put up 'pay what you want' offer. [0] https://github.com/learnbyexample/Command-line-text-processi...
In My simple GitHub project went viral
In Linux Command One-Liners
Hello! I had started tutorials on command line text processing (https://github.com/learnbyexample/Command-line-text-processi...) more than three years back. I learnt a lot writing them and continue to learn more with experience. I finished first version of cookbook on Perl one-liners recently. With that, five of the major chapters from that repo are now accessible as better formatted ebooks, updated for newer software versions, exercises, solutions, etc. You can download pdf/epub versions of the ebooks using the links below (free until this Sunday) * Perl one-liners cookbook: https://gumroad.com/l/perl-oneliners or https://leanpub.com/perl-oneliners * Five book bundle of grep/sed/awk/perl/ruby one-liners: https://gumroad.com/l/oneliners or https://leanpub.com/b/oneliners --- I'd highly appreciate your feedback and hope that you find these
Read the rest
resources useful. Happy learning and stay safe :)
In Perl One-Liners Cookbook
faizshah·Sep 9, 2020Submission

Ask HN: What are some of the cool links you've been meaning to look at?

I was going through my google keep and I found a million links to cool stuff I saw on HN. What are some you've been saving up? Here's a few from me: Perl-like one-liners with Ruby: https://github.com/learnbyexample/Command-line-text-processing/blob/master/ruby_on… Deep Learning with Pytorch in 60 mins: https://pytorch.org/tutorials/beginner/deep_learning_60min_blitz.html Financial modeling site & API that shows DCF, WACC and other data for stocks: https://financialmodelingprep.com/financial-summary/GOOGL
10 points · Open discussion
Someone else already asked for perl one-liners in this thread. I started with command line text processing repo [1] about three years back. That has a chapter on grep/sed/awk/perl/ruby one-liners along with many other tools. I may convert perl one-liners to a book as well later. Python's default 're' module does indeed lack many features, but there's 'regex' third party module that would be easier to adapt for perl users. [1] https://github.com/learnbyexample/Command-line-text-processi...
In Show HN: An eBook with hundreds of GNU Awk one-liners
Nice! A few suggestions if I may: * please consider using the same prompt for all examples, a few of them start with `code` while some others start with `awk book` and some do not have any prompt at all * split long chapters into smaller sections plus add section headings as links at the start of chapter * please please please avoid parsing ls [1] you could either reuse `sales.csv` or create another sample file instead of using `ls` as source of input... for example, your `ls -l | awk '$NF ~ /c/ {print}'` example will not work if a file is name `code xyz` (note the space) Also, I have a similar example based hundreds of gawk one-liners [2] tutorial, which I'm currently working towards publishing as a book this month with better examples, descriptions, new regex chapter, etc [1] https://unix.stackexchange.com/questions/128985/why-not-pars.
Read the rest
In Learn Awk by Example (2019)
Just for anyone else, you could probably end up in a similar corner with perl - but in both cases it's likely a case of "holding it wrong" - ruby borrows heavily from perl which borrowed heavily from shell with sed, awk, grep, cut and friends. So this kind of thing should be quite doable in a short ruby script - or a few short scripts - albeit written in "shell" style, with eg '-n or -p (wrap code in "while gets...end",-p with "puts _"), probably along with -a (automatically split lines). Its in some senses an entirely different dialect of ruby, though. Some examples here: https://github.com/learnbyexample/Command-line-text-processi...
In How to build a search engine with common Unix tools (2018) [pdf]
Perl's problem is that it's more confusing than it is powerful. I think most of the people who were into Perl for the "beauty" ended up going to ruby. People who were into it for CPAN went to python. You might find this interesting, as you can see the spirit is alive and well: https://github.com/learnbyexample/Command-line-text-processi... ruby -0ane 'print $F.shuffle[0..3].join,"\n"' < /usr/share/dict/words If you're intrigued by the idea of perl one-liners, go explore ruby.
In Password Generator
Reminds me of a similar article [1] Once you get a hang of how shell constructs like pipes, redirections, globs, variable/command substitutions, etc, the various cli text processing tools like grep, sed, awk, perl, sort, tr, pr, paste, etc are worth to learn at least the basics. They have been through years of use and heavily optimized for performance. Just today, a friend of mine called to ask how to improve a Python script's performance for 5-10 MB text file. After confirming he isn't using any other special modules, I advised to check if the performance improves by implementing it using awk. If anyone's interested in examples based tutorials on cli text processing tools, check out my github repo [2] [1] https://blog.jpalardy.com/posts/why-learn-awk/ [2] https://github.com/learnbyexample/Command-line-text-processi...
In Learn Just a Little Awk (2010)
I made a compilation of Ruby one-liners [1] as well last year. There's plenty of stuff that is similar to Perl, which in turn had borrowed from awk, sed and other tools. The biggest difference I'd pick is Perl's context based operation. # Ruby requires explicit conversion with to_i ruby -ane 'print if $F[1].to_i > 35' perl -ane 'print if $F[1] > 35' Performance is slower compared to Perl, but to those who already know Ruby, this would suit better than learning the nuances of another language. [1] https://github.com/learnbyexample/Command-line-text-processi...
In Ruby One-Liners

Showing the 15 most recent of 34 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.