8

Does someone know of a GUI application (X/GTK+/Qt/whatever) that can be used instead of less or more for viewing text, specifically one piped in from standard input? Ideally looking for something that can also run on Mac OSX (or maybe even just on Mac).

I'm looking to introduce UNIX newbies to the wonderful world of command line text processing (with awk, sed, grep and even some perl) and it would be useful to show them the text using a nice GUI that allows interactive search, scrolling with the mouse (I know most Linux terminals support mouse scrolling with less, but Mac terminals do not), etc.

The best thing I found so far was to pipe input into zenity --text-info, but that viewer is very limited and does not even allow searching.

17
  • 1
    If you're on gnome: command | gedit - (note the trailing dash) Mar 15, 2016 at 12:10
  • You can pipe with command | gvim -, if that counts.
    – Sparhawk
    Mar 15, 2016 at 12:16
  • 1
    I mean that piping stuff is primarily a CLI thing. If you put a GUI viewer into the loop you sort of break continuity. Then again, I am very used to the CLI so it might be just me. As for dealing with them, just use file=$(mktemp) and that will i) create a different file per process so you don't have to worry about name collisions and ii) create it in /tmp where they will be deleted automatically on the next reboot (depending on how your system is setup).
    – terdon
    Mar 15, 2016 at 12:28
  • 1
    Or kate with command | kate -i.
    – Sparhawk
    Mar 15, 2016 at 12:28
  • 4
    @Guss, if you "introduce UNIX newbies to the wonderful world of command line text processing" ... then why you should use graphical tools? maybe you just need to change your approach to the "introduction" and start by introducing UNIX newbies to editor available in from command line where mouse is pointless?
    – Scantlight
    Mar 15, 2016 at 13:33

2 Answers 2

3

Kate

You can pipe into kate, using command | kate -i.

From $ man kate:

   -i, --stdin
       Read the contents of stdin

Kwrite

You can pipe into kwrite with command | kwrite -i.

From $ kwrite --help:

-i, --stdin                Read the contents of stdin.

Gvim

Somewhat facetiously, you can also pipe into gvim with command | gvim -.

5
  • How exactly is that facetious? Gvim is perfectly appropriate for moments when you need w̶a̶f̶f̶l̶e̶s̶ a graphical text editor. That's the whole point. May 11, 2018 at 22:20
  • @BradenBest Facetiously, because gvim isn't a "normal" GUI program. IMO there's not a massive amount of difference between piping to gvim or vim.
    – Sparhawk
    May 12, 2018 at 2:43
  • Except gvim doesn't need a terminal. I can open my dmenu launcher and type ls | gvim - and get a gvim window with the results. No terminal emulator necessary. I could also do this from an ssh or TTY with the appropriate $DISPLAY setting. May 13, 2018 at 2:09
  • @BradenBest Agreed, but I still wouldn't call gvim a "nice GUI" for "UNIX newbies", as per the question.
    – Sparhawk
    May 13, 2018 at 5:13
  • I dunno, the GUI looks reasonably user-friendly to me. Sure the menu has like a billion functions and it isn't as simple as gedit or sublime, but if my first vim experience was with GVim, I'd at least have been able to exit the editor without Google's help :P Besides, you don't need any vim knowledge to use it as a pager. Can scroll with arrow keys, page up/down and mouse wheel no problem. I get what you're saying, though. May 13, 2018 at 7:30
3

You can pipe into leafpad. I don't know if there's a Mac port though.

1
  • Nice, I wasn't familiar with leafpad. I think its the only text editor that does this. The only downside I can see, compared to less, is that it supports BiDi "too well" and if my log lines start with Hebrew dates then the entire log line is right aligned. its worse if only some lines start with Hebwer. I found no way to disable that.
    – Guss
    Mar 15, 2016 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .