shout out to the creator of Bash for making me Bash my Fucking Skull Into A Wall every time I read a script

i know I'm a moron with bash, but come ON there has got to be a better way to massage data than grep | awk | sed

@eletious Back when I was a log jockey it was all cut, awk and perl one-liners for me. The ones that seemed to have the easiest time with it were the awk hackers; I never got that good at it but I can tell you that it generally takes less awk than perl to do the same thing when it comes to mangling text files

@swaggboi @eletious yep, awk is turning-complete even if it looks like shit. I'm not that good at it, but I'm always amazed at how powerful it is when I do use it.

nushell is pretty wild for working with data/objects instead of text, but might not be helpful for this particular usecase.

@eletious can we see a sample of your data, and what exactly you're trying to do with it? (apparently I'm a glutton for punishment)


@zyk @swaggboi sure - I'm aggregating several -p <directory> <size> arguments into an array and attempting to run du -h piped into awk to determine if a directory or file exceeds a size threshold. the trouble arose when i tried to split the du -h output into chunks for processing - using 'for i in `du -h $path`' turns the output into a space-delimited array, but then putting the du output into an array and iterating by index broke things in an even more hilarious way.

Ultimately, after spending some time AFK, I've decided that the approach was kind of dumb and I was too frustrated to actually think about it properly. I don't know how, but at one point in my fussing about I got the du output into an array, but newline-delimited instead of space delimited, and I hadn't touched IFS... at that point it was time to whine on the Internet

Sign in to participate in the conversation

are ya hungry? 🦆