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, 5:04:57 PM 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

9 sources
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
I haven't tried it yet, but it would depend on what sort of features you need Python wouldn't be a good choice for cli usage Perl is awesome to use from cli, and it is not just simple search and replace, see my tutorial[1] if you want to see examples sed and awk are awesome on their own for cli usage, sed is meant for line oriented tasks and awk for field oriented ones (there is overlap too) - one main difference compared to perl is that their regex is BRE/ERE which is generally faster but lacks in many features like lookarounds, non-greedy, named capture groups, etc you could check out sd[2] for a Rust implementation of sed like search and replacement (small subset of sed features) [1] https://github.com/learnbyexample/Command-line-text-processi... [2] https://github.com/chmln/sd
In Ripgrep 11 Released
some notes on the sample awk/sed/perl one-liner given: # input line has to be explicitly printed awk '{gsub(/Jack/,"Jill")} 1' file.txt # -i will do inplace editing, unlike the awk command # -i by itself won't work on non-GNU versions, needs backup extension sed 's/Jack/Jill/g' file.txt # use single quotes always, unless double is needed # -p will behave like default sed perl -pe 's/Jack/Jill/g' file.txt personally, I prefer the terseness of these commands over verbose SQL like syntax (and also the fact that I don't know SQL like tools) However, I would agree that initial learning curve is tough for sed/awk/perl. Once you get familiar with their idioms, they become the swiss army knife of cli text processing (along with grep). I have an entire repo dedicated to such tools[1] [1] https://github.com/learnb
Read the rest
In Show HN: Bsed – Simple, English syntax on top of Perl text processing

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.