Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I read the page a few times but I'm still scratching my head. How is this intended to be used?


Presumably it's meant to be used when you're writing a shell script and you have some problem in front of you that would be trivial to solve in a real programming language and you find yourself saying a sentence starting with "I just wanna…" and rage-googling or asking ChatGPT or whatever.


Would be great if it could show some things it can do that awk can’t. Because awk is typically my Swiss Army knife if I run into these situations.


I think it's written by someone who finds pipes and awk too awkward to work with.

I know people who can't be bothered to learn these tools and write complete programs to solve problems instead of a shell one-liner.

Looks similar.

Edit: My brain skipped words while typing.


> I think it's written by someone who finds pipes and awk too awkward to work with.

Actually it's exactly the opposite, it's born out of a love for pipes, and shells, and tools like awk. If you know anyone working at Amazon, ask them to search "11 years of work in a weekend" for a tale of shell heroics that I wrote about while I worked there.

dt is intended to be a new tool in the "shell one-liners" category, just with concatenative FP semantics. :) It will not be everyone's cup of tea, and I will still love and use awk when appropriate


> I think it's written by someone who finds pipes and awk too awkward to work with.

This one of substituting AWK/shell/sed/Perl with a forth-like lang is a good idea in a sense, it doesn't break the flow because presentation comes later and logic is at the beginning of the dt part, with the aforementioned tools you have the logic and output mixed all over the place. I will however still use AWK.


> ...it doesn't break the flow because presentation comes later and logic is at the beginning of the dt part

I didn't mean to discredit the work done. It's a big undertaking in any case. The idea and the aim is good, however it breaks the conciseness and reduces the speed of implementation.

> with the aforementioned tools you have the logic and output mixed all over the place.

I think this is a secondary effect of composability, pipe and conciseness requirement.

> I will however still use AWK.

Me too, and this is why I made my prior comment, exactly.


awk is an inspiration, and a great simple tool. Not trying to compete, but add more tools in the space.

Probably dt will never be able to do things that awk can't do... At least for the non-trivial things. But I think it will be able to do some things with a more readable/declarative syntax.

I'll fill this out later, but imagine dt as trying to be a shell-friendly Functional Programming riff on awk, with first-class functions and no need to regex match or BEGIN etc. At the end of the day, assuming it catches on, I suspect choosing dt will probably be more often about taste


> you have some problem in front of you that would be trivial to solve in a real programming language

Which is the exact point in time when I solve the problem by using a real programming language.


Isn't that why Larry made perl? To avoid using a real programming language like awk? ;)


My read as well.

I write shell-scripts when the current tools solve the problem easily. I distribute shell scripts to colleagues (never customers) only when I absolutely do not want to install extra software on their system.

I avoid awk and perl because if I'm going to introduce a second language to a tool, I'm not going to pick the niche ones everyone only learns opportunistically if at all. At that point I'd rather pick something my colleagues are deeply familiar with.

And on a small level, writing these little binaries that truly do one thing and do it well and that I understand intimately is a private joy.


Awk and Perl niche? How about "reliably installed on every GNU/Linux box this side of the century". Their fault for not knowing their own systems. Anything pre-installed is fair game.


Yeah, the examples are focused on dt’s internal state and features. A few real world practical examples of what you can do with it would be much better.


For example I am trying to figure out how I would split each line on a delimiter. I cant figure out what the syntax is

dt [ "," split ] pls prints split

dt [ "," split ] map pls prints stack underflow

I think I could definitely use this if it had better docs and I could figure out how to.


I don't know what that is intended with that, but for simple line splits I'd use awk, which is typically everywhere, and its parameter -F (F there stands for field separator) that is, given the file L with the lines

   hello,world,one
   maybe,baby,you
awk -F, '{ print $2 }' L

should give

   world
   baby
(tested on https://busybox.net/live_bbox/live_bbox.html )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: