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

Align \tsp functionality from external program ?

Expand Messages
  • meino.cramer@gmx.de
    Hi, this is a somehow reversed vim question. I use Align from Dr Chip a lot and I like it a lot. Currently I want to reformat the output from find / -ls
    Message 1 of 12 , Oct 31, 2009
      Hi,

      this is a somehow "reversed" vim question.

      I use Align from Dr Chip a lot and I like it a lot.
      Currently I want to reformat the output from "find / -ls"
      (so to say a "carbon copy" from the filenames of the
      files of my system :O) ) with
      \tsp via the Align tool.

      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?

      Thank you very much for any help in advance!

      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! ... Well first say what exactly tsp is doing. I am not using Align.vim so I do not know. Then second, please give an example, what your data
      Message 2 of 12 , Nov 1, 2009
        Hi meino.cramer!

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

        > I use Align from Dr Chip a lot and I like it a lot.
        > Currently I want to reformat the output from "find / -ls"
        > (so to say a "carbon copy" from the filenames of the
        > files of my system :O) ) with
        > \tsp via the Align tool.
        >
        > 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?

        Well first say what exactly \tsp is doing. I am not using Align.vim so I
        do not know. Then second, please give an example, what your data looks
        like and how you would like to have it formated.


        regards,
        Christian
        --
        • Only wimps use tape backup: _real_ men just upload their important stuff on
        ftp, and let the rest of the world mirror it ;)
        Torvalds, Linus (1996-07-20). Post to linux.dev.kernel newsgroup.
        Retrieved on 2006-08-28.

        --~--~---------~--~----~------------~-------~--~----~
        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.brabandt 1.) tsp aligns columns on word boundaries 2.) submit find . -ls in a small directory and take a look at the output. mcc ... -- Please
        Message 3 of 12 , Nov 1, 2009
          hi christian.brabandt

          1.) \tsp aligns columns on word boundaries
          2.) submit 'find . -ls' in a small directory and take a look at the
          output.

          mcc



          Christian Brabandt <cblists@...> [09-11-01 09:28]:
          >
          > Hi meino.cramer!
          >
          > On So, 01 Nov 2009, meino.cramer@... wrote:
          >
          > > I use Align from Dr Chip a lot and I like it a lot.
          > > Currently I want to reformat the output from "find / -ls"
          > > (so to say a "carbon copy" from the filenames of the
          > > files of my system :O) ) with
          > > \tsp via the Align tool.
          > >
          > > 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?
          >
          > Well first say what exactly \tsp is doing. I am not using Align.vim so I
          > do not know. Then second, please give an example, what your data looks
          > like and how you would like to have it formated.
          >
          >
          > regards,
          > Christian
          > --
          > • Only wimps use tape backup: _real_ men just upload their important stuff on
          > ftp, and let the rest of the world mirror it ;)
          > Torvalds, Linus (1996-07-20). Post to linux.dev.kernel newsgroup.
          > Retrieved on 2006-08-28.
          >
          > >

          --
          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! ... Well may be I am a little bit confused today, but I still don t understand. Is your output not aligned? If I see this correctly, then it
          Message 4 of 12 , Nov 1, 2009
            Hi meino.cramer!

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

            > 1.) \tsp aligns columns on word boundaries
            > 2.) submit 'find . -ls' in a small directory and take a look at the
            > output.

            Well may be I am a little bit confused today, but I still don't
            understand. Is your output not aligned? If I see this correctly, then it
            should already be aligned. That's why I told you to give an example of
            what exactly you see and what you want.

            Mit freundlichen Grüßen
            Christian
            --
            Alle reden vom Zeit totschlagen, dabei schlägt die Zeit uns tot.
            -- Alphonse Allias

            --~--~---------~--~----~------------~-------~--~----~
            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 No, it is not, since beside other attriibutes the filename, filesize and timestamps occupy different amount of space from file to file
            Message 5 of 12 , Nov 1, 2009
              Christian Brabandt <cblists@...> [09-11-01 11:16]:
              >
              > Hi meino.cramer!
              >
              > On So, 01 Nov 2009, meino.cramer@... wrote:
              >
              > > 1.) \tsp aligns columns on word boundaries
              > > 2.) submit 'find . -ls' in a small directory and take a look at the
              > > output.
              >
              > Well may be I am a little bit confused today, but I still don't
              > understand. Is your output not aligned? If I see this correctly, then it
              > should already be aligned. That's why I told you to give an example of
              > what exactly you see and what you want.
              >
              > Mit freundlichen Grüßen
              > Christian
              > --
              > Alle reden vom Zeit totschlagen, dabei schlägt die Zeit uns tot.
              > -- Alphonse Allias
              >
              > >

              Hi christian.brandt

              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.

              137535 1622 -rw-r--r-- 1 iceman users 1658249 Sep 2 2006 ./tmp/hs-1.7z
              137536 1622 -rw-r--r-- 1 iceman users 1658445 Sep 2 2006 ./tmp/hs-2.7z
              137537 1622 -rw-r--r-- 1 iceman users 1658445 Sep 2 2006 ./tmp/hs-3.7z
              14292806 0 drwx------ 2 iceman users 208 Apr 17 2009 ./dta
              23251336 317 -rw------- 1 iceman users 5222169 Feb 14 2009 ./dta/01_Land.ogg-7c3b8c7d-9246-4e24-b25d-f8190b949e28-.dtapart
              22987380 1028 -rw------- 1 iceman users 8294778 Feb 14 2009 ./dta/01_Land.mp3-0c320779-f41a-4be0-9e8f-4d0c033f6018-.dtapart
              8535498 408 -rw-r--r-- 1 iceman users 415372 Oct 18 2007 ./log
              16892555 4 -rwxr-xr-x 1 root root 265 Aug 4 2008 ./rme
              29695850 0 drwxr-xr-x 4 iceman users 96 May 29 17:08 ./usr
              29695851 0 drwxr-xr-x 2 iceman users 72 May 29 17:08 ./usr/bin
              29697990 4 -rwxr-xr-x 1 iceman users 58 Jan 17 2009 ./usr/bin/tragtor
              29697991 0 drwxr-xr-x 5 iceman users 128 May 29 17:08 ./usr/share
              29698014 1 drwxr-xr-x 2 iceman users 1424 May 29 17:08 ./usr/share/tragtor
              29698126 120 -rw-r--r-- 1 iceman users 119355 Apr 20 2008 ./usr/share/tragtor/nb-format.svg
              29698125 52 -rw-r--r-- 1 iceman users 52205 Feb 7 2008 ./usr/share/tragtor/meta.svg


              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
              -~----------~----~----~----~------~----~------~--~---
            • 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 6 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 7 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 8 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 9 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 10 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 11 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 12 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.