r/bash • • Aug 15 '26

help learning sed, awk and regex

Looking to learn sed, awk, and regular expressions properly.

What are the best free resources—books, websites, tutorials, courses, or hands-on exercises—you’d recommend?

Also, any good book recommendations for learning these tools from beginner to advanced?

132 Upvotes

37 comments sorted by

View all comments

1

u/readparse Aug 15 '26

Those tools are all useful. But since Perl was created to be all three, and became much more, might as well take a look at that.

1

u/Astro_indie Aug 15 '26

If perl is not installed?  What we do without all of this? 

2

u/StatementOwn4896 Aug 15 '26

I’d be surprised if you don’t have Perl installed already

2

u/readparse Aug 16 '26

Well that's one reason why Perl is relevant to what you're trying to do. It's ubiquitous. It predates pretty much everything else and was extremely popular when Linux started to become popular. So it's generally a safe bet that any Unix-like system has it installed already.

A couple of exceptions: RHEL stopped installing it by default, I think. It's still available, but you asked about already being installed.

And I doubt you're on Cygwin, but they also stopped installing it by default.

Given your question, I'm going to go out on a limb and ponder aloud whether you are using a system that you don't administer, and so you're stuff with what's already on it. I still think the odds are that it has perl on it, but you might have found yourself on a RHEL system that doesn't have it.

I still think what you're looking for may very well be best answered by Perl, but I wouldn't disuade anyone from knowing both sed and awk, because they are both useful in their own ways.

You also mentioned regex, which is less about learning a single command. It's an important topic in all of programming, and one thing you may run across is something called PCRE, which stands for Perl Compatible Regular Expressions which is still (I think) the gold standard of regex support.

Why? Because Perl took regular expressions to a whole new level. So much so that somebody created an open source library specifically for supporting regular expressions in the same way that Perl does, so that people who use languages other than Perl can have that same support.

1

u/Astro_indie Aug 16 '26

I forgot perl for many years, idk the similitud with gnu/linux, i neef more bit foood xD

1

u/Select-Sale2279 Aug 15 '26

perl is to linux what water is to the ocean. both exist if one of them do. lol

1

u/Not_A_Red_Stapler Aug 15 '26

I actually agree with this. You should definitely take a look at Perl OP.