From: Karel Zak <kzak@redhat.com>
To: Thomas Voss <mail@thomasvoss.com>
Cc: util-linux@vger.kernel.org
Subject: Re: Proposal for new column(1) flag
Date: Mon, 17 Oct 2022 10:42:47 +0200 [thread overview]
Message-ID: <20221017084247.egoe7ljueklp5jvb@ws.net.home> (raw)
In-Reply-To: <CNL1J5PPBA9T.2ZR8EL0OSX1XJ@mango-os>
On Thu, Oct 13, 2022 at 09:26:11PM +0200, Thomas Voss wrote:
> Hello there,
>
> I'm not sure if this is exactly the right place to ask, so forgive me if
> it isn't but I was thinking of a potential new flag for the column(1)
> utility and would like to get some feedback on whether or not it would
> even be accepted before I try to submit a patch.
>
> The basic issue I am aiming to fix is this: When you have a bunch of
> lines and you want to display them in a more "human friendly" manner, you
> may decide to display them using columns. This is what ls does as the
> default behavior when listing files and we can in theory do this by
> piping the output of whatever command we run into column. The issue I
> found however is that the way column operates is by splitting each row
> into multiple columns where every column has the same width (a width
> which can hold the longest input line). ls on the other hand tries to
> make each column as thin as possible, with a gap of two spaces between
> each column. This means that in many cases ls can fit the same data into
> more columns than center can.
>
> Now when listing files this is not a problem, you can always use ls
> instead of center. But I recently found myself wanting to do this with a
> list of movies that I had stored in a file, and so being able to just the
> following would be much more convenient, but the gaps between the columns
> is just too large:
>
> $ column movie-list
>
> So my proposal is to add a new flag, perhaps -g (g for gap) which allows
> you to specify how wide you want the gaps between the columns to be in
> spaces, and then to columnate that way. That change would make these two
> lines identical:
>
> $ ls *
> $ ls * | column -g 2
I guess you want "table" mode for the column (see --table-* options).
It provides almost all features from libsmartcols. The next important
thing for your use-case is --output-separator, for example
$ echo "AAA BBB CCC" | ./column -t --output-separator "..."
AAA...BBB...CCC
of course you can use " " to define space as separator, etc.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2022-10-17 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 19:26 Proposal for new column(1) flag Thomas Voss
2022-10-13 20:43 ` Bernhard Voelker
[not found] ` <CNO4L8IMOGYS.1DZ36WVMXZ8K4@mango-os>
2022-10-17 18:08 ` Bernhard Voelker
2022-10-17 8:42 ` Karel Zak [this message]
2022-10-17 10:10 ` Thomas Voss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221017084247.egoe7ljueklp5jvb@ws.net.home \
--to=kzak@redhat.com \
--cc=mail@thomasvoss.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox