Live data from Hacker News

Show HN: I wrote a program to convert lines of text into trees

github.com

31–40 of 58 posts

Re: Show HN: I wrote a program to convert lines of text into trees

#31
I love what it does for log files. Abbreviated example from the README:

    May 10 03:17:06 localhost systemd: Removed slice User Slice of root.
    May 10 03:17:06 localhost systemd: Stopping User Slice of root.
becomes:

    May 10
     03:17:06 localhost systemd
      : Removed slice User Slice of root
      : Stopping User Slice of root

Re: Show HN: I wrote a program to convert lines of text into trees

#32
post #19

Maybe this is not super relevant, but my favorite hack is that any tree-like structure like this can be browsed with ncdu. Here's a gist for breaking down redis traffic by command for example: https://gist.github.com/petethepig/0f33c910fb2edad8969a5775e...

Neat! Is there some documentation on the format ?

https://dev.yorhel.nl/ncdu/jsonfmt

Re: Show HN: I wrote a program to convert lines of text into trees

#33
In retrospect, it’s not clear to me why I somehow expected this project to be something more literally arboreal. I even got my hopes up further when I clicked the link and saw that photo of plumerias.

Yet, this project is cool enough that I’m not even disappointed.

Re: Show HN: I wrote a program to convert lines of text into trees

#34
post #16

Whoa, he wrote a parser. This only happens every other decade or so.

You've been breaking the site guidelines badly. If you keep doing this we will have to ban you.

Please review https://news.ycombinator.com/newsguidelines.html and stick to the rules from now on.

Re: Show HN: I wrote a program to convert lines of text into trees

#35
post #2

Author here: Often I have to digest log files and lists of Azure resource names. I prefer to work with hierarchies of things, so I wrote this simple filter. Turns out to quite handy, especially when combined with awk and its friends.

I love this as a post-processor for log-files. We actually have something like this at work. Unfortunately, it's applied to log-files by default. It's terrible: it breaks grep, and I haven't been able to figure a way around that.

Have you found any solutions for grepping on matching lines? Presumably, one could use awk, but awk takes a lot of cycles.

Re: Show HN: I wrote a program to convert lines of text into trees

#36
post #6
post #2

Author here: Often I have to digest log files and lists of Azure resource names. I prefer to work with hierarchies of things, so I wrote this simple filter. Turns out to quite handy, especially when combined with awk and its friends.

Very cool tool! Any chance that you're going to add it to Homebrew?

https://github.com/birchb1024/frangipanni/issues/2

Re: Show HN: I wrote a program to convert lines of text into trees

#37

Earlier quoted context omitted.

What do you mean? The only reason this didn't exist is nobody did it yet. It doesn't contradict "do one thing and do it well".

For me, the problem isn’t that it doesn’t do one thing well, which is clearly does, it’s that there are no other tools to process trees. So it fits well with the UNIX ethos of a small tool doing one thing well, but not so much the concept of pipelines, which is closely related. Obviously not this tool’s fault.

I does take advantage of pipelines, as long as it is on the end. You can use awk, sed, cut, sort, grep and a hose of other tools to massage the data before it gets put into graph form.

To become the front-end of a pipe requires that its or some other hierarchical format become an effective standard shared by a number of tools. It can happen.

Re: Show HN: I wrote a program to convert lines of text into trees

#38
post #12

Awesome. You really nailed it. In my experience the output for spreadsheets turns out to be key so good job highlighting that ( https://github.com/birchb1024/frangipanni#output-for-spreads... ). One suggestion: it may help to generalize the newline as the node separator. You may already be doing this (my go is rusty) but instead of https://github.com/birchb1024/frangipanni/blob/7543b4ee15ae7... be able to override th…

really cool! But I think you should have called it "birch"! :) Any way you could add build instructions to the README?

I also wanted to vote for "birch". Apparently "frangipanni" is a nice flower, but it reminds me of an unpleasant (imho) German dessert ("frangipane").

Re: Show HN: I wrote a program to convert lines of text into trees

#39
Seen this about 50 years ago. It was method of saving expensive Teletype ink ribbons. Instead of printing same repeating messages on mainframe log, it printed only those parts that were different from previous line.

And of course empty line was "ditto". Except this wasted paper and was later replaced with "...".

Re: Show HN: I wrote a program to convert lines of text into trees

#40

I love what it does for log files. Abbreviated example from the README: May 10 03:17:06 localhost systemd: Removed slice User Slice of root. May 10 03:17:06 localhost systemd: Stopping User Slice of root. becomes: May 10 03:17:06 localhost systemd : Removed slice User Slice of root : Stopping User Slice of root

Definitely very interesting! But I think I'd often end up stuck in the middle of a file with no context about the time of the current line, and struggling to scroll up to capture the parent without shooting past it.

Maybe that could be resolved if it were combined with some sort of GUI / TUI that collapsed subtrees with default (maybe with child count and total anscentor count) e.g. folding by indentation in Vim / Emacs

Post reply on HN