this post was submitted on 23 Jun 2023
6 points (100.0% liked)

Linux

114 readers
1 users here now

founded 2 years ago
 

Linux is known for its flexibility and customization options, and there are countless tools and commands available for users to explore. However, two of the most versatile and powerful tools that every Linux geek should know are sed and awk. These command-line tools have been around for decades and are still widely used by system administrators, programmers, and power users alike. In this article, we’ll explore why every Linux geek needs to know these two tools. First, let’s define what sed and awk are. Sed (short for “stream editor”) is a command-line tool that is used for performing simple text […]

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago (1 children)

I'll probably need a few more lines in Python, but I can do everything i want and don't have to deal with the cryptic syntax. I once had to use awk because some extra pigheaded sysadmin refused to install Python on an AIX machine. Glad i don't work there any more.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Python isn't really a fantastic drop-in replacement for them, IMHO, though there is some overlap.

There are a bunch of Unix tools that let one concisely put a lot of logic into a single command line. They lower the bar to throwing a lot of logic into that single line.

Python's whitespace-sensitive and requires newlines. I guess theoretically you could use a HEREDOC or something, but realistically, if you use Python, you're going to go author a throwaway script and then execute it, which raises the bar to just including it in your command lines.

I think that Perl is probably closer to a middle ground between "application-oriented programming languages" and "single command line use". I think that it'd be reasonable to simply use perl -pie as an alternative to awk especially, though having sed's conciseness is still nice.