Is anyone using awk?

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.

calzone_gigante,

Yes, for things too complex to do in sed but not complex enough to need a “normal” programming language like python.

wuphysics87,

I use sed a lot

sxan,
@sxan@midwest.social avatar

Nearly every day. There was a time when I’d reach for Ruby, but in the end, the stability, ubiquity, and portability of the traditional Unix tools - among whom awk is counted - turned out to be more useful. I mainly underuse its power, though; it serves as a column aggregator or re-arranger, for the most part.

starman,
@starman@programming.dev avatar

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

allywilson,

I don’t tend to use awk in scripts as I do tend to do them in Python, but I do use awk on almost daily basis in one-liners.

Probably the most common thing for me is so I can read a config file without annoying comments and big line spaces.

grep -v “^#” krb5.conf | awk NF

hersh,

All the time. Not always by choice!

A lot of my work involves writing scripts for systems I do not control, using as light a touch as is realistically possible. I know for a fact Python is NOT installed on many of my targets, and it doesn’t make sense to push out a whole Python environment of my own for something as trivial as string manipulation.

awk is super powerful, but IMHO not powerful enough to justify its complexity, relative to other languages. If you have the freedom to use Python, then I suggest using that for anything advanced. Python skills will serve you better in a wider variety of use cases.

j4k3,
@j4k3@lemmy.world avatar

With embedded like OpenWRT on a router where you only have busybox/ash shell, awk is your primary expansions tool.

SpaceNoodle,

I haven’t found a use for awk that couldn’t be accomplished with bash builtins or other common commands.

filister,

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

FaceButt9000,

I use it multiple times a day. I only know basic usage, but it’s super useful as part of an awk/grep/sort/uniq pipeline, basically just extracting a field to work on.

picandocodigo,
@picandocodigo@lemmy.world avatar

I learned awk when I was studying and I still use it every now and then. It’s one of those tools that come in really handy at times. I work in Ruby, but there’s still times when scripting or just wanting to process some text when I end up using awk because it makes sense.

FigMcLargeHuge,

I use awk constantly at work. Very useful in my opinion, and really powerful if you dig into it.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #