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

Re: Align \tsp functionality from external program ?

Expand Messages
  • Michael Henry
    ... My preferred command-line tool would be... ``find`` :-) The ``find`` command has quite a lot of formatting capability built in, using the ``-printf``
    Message 1 of 12 , Nov 1, 2009
      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
      -~----------~----~----~----~------~----~------~--~---
    • Christian Brabandt
      Hi meino.cramer! ... You can try as - already mentioned - using find -printf. I am not sure, this works always, cause it seems it is not mentioned in SuSv3.
      Message 2 of 12 , Nov 1, 2009
        Hi meino.cramer!

        On So, 01 Nov 2009, meino.cramer@... wrote:

        > No, it is not, since beside other attriibutes the filename, filesize
        > and timestamps occupy different amount of space from file to file if
        > find is applied to a complete directory tree (too much files to cope
        > with in one buffer) being huige enough.

        You can try as - already mentioned - using find -printf. I am not sure,
        this works always, cause it seems it is not mentioned in SuSv3. An
        alternative would be to pipe the output of find through awk and using
        its printf statements, you should be able to get it aligned and formated
        nicely.

        regards,
        Christian

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • meino.cramer@gmx.de
        ... Hi, the main problem with a list of currently 1298170 entries is just to know the max. width of eact entry before genrating the list. Thats why I want to
        Message 3 of 12 , Nov 1, 2009
          Michael Henry <vim@...> [09-11-01 12:12]:
          >
          > 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
          >
          >
          > >

          Hi,

          the main problem with a list of currently 1298170 entries is
          just to know the max. width of eact entry before genrating
          the list.
          Thats why I want to put this job onto my systems shoulders.

          I think for that reason 'find' is'nt what I want to use as
          a formatter.

          Thanky for your help anyway...

          Keep hacking!
          mcc
          --
          Please don't send me any Word- or Powerpoint-Attachments
          unless it's absolutely neccessary. - Send simply Text.
          See http://www.gnu.org/philosophy/no-word-attachments.html
          In a world without fences and walls nobody needs gates and windows.


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • meino.cramer@gmx.de
          ... hi christian.brandt awk is processing its input line by line. Its script applies to one line and with the next line of input the previous one is forgotten
          Message 4 of 12 , Nov 1, 2009
            Christian Brabandt <cblists@...> [09-11-01 12:24]:
            >
            > Hi meino.cramer!
            >
            > On So, 01 Nov 2009, meino.cramer@... wrote:
            >
            > > No, it is not, since beside other attriibutes the filename, filesize
            > > and timestamps occupy different amount of space from file to file if
            > > find is applied to a complete directory tree (too much files to cope
            > > with in one buffer) being huige enough.
            >
            > You can try as - already mentioned - using find -printf. I am not sure,
            > this works always, cause it seems it is not mentioned in SuSv3. An
            > alternative would be to pipe the output of find through awk and using
            > its printf statements, you should be able to get it aligned and formated
            > nicely.
            >
            > regards,
            > Christian
            >
            > >

            hi christian.brandt

            awk is processing its input line by line. Its script applies
            to one line and with the next line of input the previous one
            is forgotten -- or I have to program a script which read the
            input twice:
            First run to determine the correct alignment spaces, second
            run to apply those -- and this will become more of a hack
            due to the nature of awks processing the input.
            But as mentioned I want to 'use' a tool, not to program one.

            I think, the best will be to hack one in C -- this will run by
            far faster then the script processing done by awk.

            Thanks for your help.

            Keep hacking!
            mcc



            --
            Please don't send me any Word- or Powerpoint-Attachments
            unless it's absolutely neccessary. - Send simply Text.
            See http://www.gnu.org/philosophy/no-word-attachments.html
            In a world without fences and walls nobody needs gates and windows.


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Christian Brabandt
            Hi meino.cramer! ... A little script, possibly, yes. This shouldn t be that hard. Another possibility, I forgot about is column(1). This should be exactly what
            Message 5 of 12 , Nov 1, 2009
              Hi meino.cramer!

              On So, 01 Nov 2009, meino.cramer@... wrote:

              > awk is processing its input line by line. Its script applies
              > to one line and with the next line of input the previous one
              > is forgotten -- or I have to program a script which read the
              > input twice:

              A little script, possibly, yes. This shouldn't be that hard.

              Another possibility, I forgot about is column(1). This should be exactly
              what you are looking for.

              regards,
              Christian
              --
              • …the Linux philosophy is 'laugh in the face of danger'. Oops. Wrong one.
              'Do it yourself'. That's it.
              Torvalds, Linus (1996-10-16).

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • bob davis
              ... As suggested previously... I just tested this and it seems to work. find . -ls|column -t|less -SiX The less is just for my viewing.
              Message 6 of 12 , Nov 1, 2009
                > the main problem with a list of currently 1298170 entries is
                > just to know the max. width of eact entry before genrating
                > the list.
                > Thats why I want to put this job onto my systems shoulders.
                >
                > I think for that reason 'find' is'nt what I want to use as
                > a formatter.
                >
                > Thanky for your help anyway...
                >
                > Keep hacking!
                > mcc
                >
                As suggested previously...
                I just tested this and it seems to work.

                find . -ls|column -t|less -SiX

                The less is just for my viewing.


                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • meino.cramer@gmx.de
                ... Hi, YEAH! This is the tool I have searched for. With it I will be able to handle files/texts of that size without waiting half a day (*NO* critism against
                Message 7 of 12 , Nov 1, 2009
                  bob davis <bob@...> [09-11-01 15:24]:
                  >
                  >
                  >
                  >
                  > > the main problem with a list of currently 1298170 entries is
                  > > just to know the max. width of eact entry before genrating
                  > > the list.
                  > > Thats why I want to put this job onto my systems shoulders.
                  > >
                  > > I think for that reason 'find' is'nt what I want to use as
                  > > a formatter.
                  > >
                  > > Thanky for your help anyway...
                  > >
                  > > Keep hacking!
                  > > mcc
                  > >
                  > As suggested previously...
                  > I just tested this and it seems to work.
                  >
                  > find . -ls|column -t|less -SiX
                  >
                  > The less is just for my viewing.
                  >
                  >
                  > >

                  Hi,

                  YEAH! This is the tool I have searched for. With it I
                  will be able to handle files/texts of that size without
                  waiting half a day (*NO* critism against vim or Align
                  intended!!!).

                  Thanks for your patience and help!

                  Keep hacking!
                  mcc

                  --
                  Please don't send me any Word- or Powerpoint-Attachments
                  unless it's absolutely neccessary. - Send simply Text.
                  See http://www.gnu.org/philosophy/no-word-attachments.html
                  In a world without fences and walls nobody needs gates and windows.


                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.