Loading ...
Sorry, an error occurred while loading the content.

108861Re: Align \tsp functionality from external program ?

Expand Messages
  • Michael Henry
    Nov 1, 2009
    • 0 Attachment
      On 11/01/2009 01:51 AM, meino.cramer@... wrote:
      > Hi,
      >
      > I use Align from Dr Chip a lot and I like it a lot.
      > Currently I want to reformat the output from "find / -ls"
      > [...]
      >
      > Unfortunaltely the list is VERY VERY long and it takes
      > a (too) long time to reformat the whole stuff with vim/Align
      > (no critosm intended !!!).
      >
      > Is there any unix/linux commandline tool which can do
      > that job in a shorter time since it is written in C?

      My preferred command-line tool would be... ``find`` :-)

      The ``find`` command has quite a lot of formatting capability
      built in, using the ``-printf`` option. Your invocation above
      with the ``-ls`` option can be written as below, with your own
      chosen field widths such that the columns are wide enough to
      keep thing nicely aligned:

      find / -printf "%-12i %-8k %M %-2n %-16u %-16g %-12s %Cb %Cd %CY %p\n"

      Column widths are chosen by the numbers after the "%"
      characters, and the "-" character means to left-justify the
      field. See the ``find`` manpage for more information, and
      search for ``printf`` to see the many options available.

      One downside to the above-suggested method is that you have to
      choose large enough field widths that your data will always fit
      in the columns. I don't know of a way to have ``find``
      calculate the minimum field width based on the data. If that's
      a requirement, you might need a separate program to format the
      fields.

      Michael Henry


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 12 messages in this topic