Studying and awk came up.

Spent about an hour and I see some useful commands that extend past what “cut” can do. But really when dealing with printf() format statements is anyone using awk scripts for this?

Or is everyone just using their familiar scripting language. I’d reach for Python for the problems being presented as useful for awk.

0 points

No, but I heavily use perl still… I feel like you can’t really call yourself a Linux person without knowing perl and python both. Knowing awk can’t hurt though.

permalink
report
reply
3 points

Really? I disliked Perl for 3 decades on unix and Linux and I’ve never felt like I have been held back by not knowing or using it. I don’t remember the last time I saw a Perl script, let alone needed to understand one.

permalink
report
parent
reply
8 points
*

Grep is fiiiiine.

sed is okay but a little nasty, when your sed script is longer that one search-replace command you gotta ask yourself what you’re doing really (yes, sed is a full-featured Turing-complete programming language, if you go far enough into the man page).

When I see awk in any stackoverflow recipe, I just say ‘fuck it’ and rewrite the whole thing in Python. Python is included into the minimal system image in Debian, the same as awk, but is way less esoteric, and you can do python -e 'import os, sys; commands;' for a one-liner console script.

And if you want to talk about portability, try writing scripts for Android 4.4 ash shell. There’s no [ ] command. You do switch/case to compare strings.

permalink
report
reply
1 point

Have you tried ripgrep?

permalink
report
parent
reply
4 points

No, and I don’t think I will learn another tool for something that I can already do using grep/sed/find commands, which I know by heart.

permalink
report
parent
reply
1 point

That’s fair

permalink
report
parent
reply
-1 points

Perl kinda killed awk and sed.

Then python kinda killed perl.

permalink
report
reply
1 point

I used awk until perl, then there was no going back.

permalink
report
parent
reply
-4 points

Just use awk and when needed ask ChatGPT for the syntax of the command

permalink
report
reply
2 points

No, I don’t need it because of jc and nushell

permalink
report
reply

Linux

!linux@lemmy.ml

Create post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Community stats

  • 9.6K

    Monthly active users

  • 5.8K

    Posts

  • 162K

    Comments