Community
    • Login

    Adding line breaks to fixed width table

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 3 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Stinson's StationersS
      Stinson's Stationers
      last edited by

      Yes, i apologize about that, it is company data and i can’t really just post it publicly.
      i’ll see if i scrub several lines and post that.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Stinson's Stationers
        last edited by Alan Kilborn

        @Stinson-s-Stationers

        I’d say definitely publish a representative version of the “some header code” as well as the other scrubbed lines.

        Stinson's StationersS 1 Reply Last reply Reply Quote 0
        • Stinson's StationersS
          Stinson's Stationers
          last edited by

          Here is a data sample. I have to stretch my notepad++ window to almost full scree to get it to line up as a table. i believe it was originally formatted to print on an old landscape-format dot matrix printer. as for the header code, it doesn’t really come through in notepad like XML or some other recognizable language. it is mostly empty squares and maybe assembly symbols? not really familiar, but i didn’t think that would help, but i can try to copy that if you think it will help.
          CPIXXXXXXXXXT 2RTXXXXXXFT CPI RXXXXSTREH65 EA EA XXXXX .XXX .XXX .XXX .X N DMXXXXXXXXXXXXXXXXNO UPDATE CPXXXXXXXXXX0RE 3RMXXXXXXXXXE CPI XXXXXXXXX200 EA EA 1XXXX50 1XXXX50 1XXXX60 1XXXXX0 .X N DMXXXXXXXXXXXXXX ACXXXXXXX THXXXXXXXXXTTEN CPXXXXXXXXXXXRE 4RXXXXXXXXXRE CPI FXXXXXXXXXXX EA EA 1XXXXXX 1XXX350 1XXXXX0 1XXXX50 .0 N DXXXXXXXXXXXXXXXXXXXXXXXXXXXTXXNXLXSXRXTXEN CPIXXXXXXXXXXXX 5RMXXXXXXXXXE CPI FUXXXXXXXX03 EA EA 8XXX60 123XXXX 8XXXX0 1XXXX70 .0 N XXXXXXXXXXXXXXXXXXXXXXXXMXRXTXAX XIXXXXXTEN KAXXXXXXXX 6KXXXXXX KAT LXXXXXXXXXXM EA EA 2XXX70 3XXX00 27XXXX 30XXX0 .0 N DXXXXXXXXXXXXXXXXXXXXXX XXRXTXAX XXSXXIXTXN MSXXXXXXXXXXXXX 7XXXXXXXXXX16 MSE LXXXXXXXXXXP EA EA 1XXXX40 19XXX00 XXX00 XXXX .0 N SXXXXXXXXXXXDXSXAXPXIXEXXAXNXXXXXXTE MSXXXXXXXXXXXX 8XXXXXXXXX16 MSE PXXXXXXXX00 EA EA XXXX00 X1XX.X0X XXXXX0 XXXXXX0 .0 N SXXXXXXX XXNX XWXPXRXXEXVAXXXXXXXXTE XXXXXXXXXXXX 91XXXXXXX6 XER XXXXXXXXSER EA EA 13XXXX0 XXXXXX80 XXXXX XXXX XX N XYXNXXXX XEXDXSWXPXXICX XXXXOXUXXXTE MIXXXXXXXXX 10XXXXXXX0 MII GXXXXXXXXXPD BX BX XXXXXX20 XXXXXX20 XXXXX00 XXXX0 .0 N PXIXEXVXRXOXUXXXXXXXX MIXXXXXXXXX 11XXXXXXX1 MII GXXXXXXXXXX BX BX XXXX20 XXXXX20 XXXXX00 XXXX .0 N XXXXXXXXXXXXXXXXTE MIXXXXXXXXX 12XXXXXXX2 MII GXXXXXXXXX BX BX XXXXXX0 XXXXXX0 XXXXX0 XXXXX .0 N PXIXEXVXXNX XXXAXX MIXXXXXXXXX 13XXXXXXX3 MII GXXXXXXXXXXD BX BX XXXXXX XXXXXX XXXX XXX0 .0 N XXXXX VXXXX XXXXXXX MIIPRO31764 1XXXXXXXX4 MII GXXXXXXXXXXD BX BX 4XXXXX 3XXXX0 XXX0 XXXXX0 .0 N XXXXXXXXXXXXXXXXXXXXXXXXXXX

          Terry RT Stinson's StationersS 2 Replies Last reply Reply Quote 0
          • Stinson's StationersS
            Stinson's Stationers @Alan Kilborn
            last edited by

            @Alan-Kilborn Also, i forgot to mention that i just delete all the symbols in the “header code” because i assume they are either instructions to whatever printer this went to once upon a time, or instructions to the app itself for reading the file. My job is just to try to pull data.

            Alan KilbornA 1 Reply Last reply Reply Quote 0
            • Alan KilbornA
              Alan Kilborn @Stinson's Stationers
              last edited by

              @Stinson-s-Stationers

              So… the header’s gone, so no longer a concern.

              Really now you just need to add a line break after a certain number of columns.

              The way you pasted your sample data doesn’t really help; a before/after would have helped.

              So anyway, you can break your data into constant fixed length lines by:

              • invoking Replace by pressing Ctrl+h
              • selecting Regular expression for the Search mode
              • ticking the Wrap around checkbox
              • putting .{n} in the Find what box (n is whatever you need for columns)
              • putting $0\r\n in the Replace with box
              • pressing the Replace All button
              Stinson's StationersS 1 Reply Last reply Reply Quote 1
              • Terry RT
                Terry R @Stinson's Stationers
                last edited by

                @Stinson-s-Stationers said in Adding line breaks to fixed width table:

                it doesn’t really come through in notepad like XML or some other recognizable language. it is mostly empty squares and maybe assembly symbols?

                The reason is that the so called “header code” is in reality the start of a binary file, information that is just for the original application to understand. Notepad++ isn’t designed to edit binary files, even if most of the data is just plain text.

                Whilst this process of massaging the data into multiple lines will probably work I’d be cautious about doing so. My preference would be to get a 'freeware" DBF viewer that can export the data in multiple formats, such as is available here. The first one called DBF Viewer Plus even gives a TXT export function. It will likely either provide fixed width columns and/or comma delimited data.

                my 2c worth
                Terry

                Stinson's StationersS 1 Reply Last reply Reply Quote 1
                • Stinson's StationersS
                  Stinson's Stationers @Terry R
                  last edited by

                  @Terry-R It didn’t even occur to me that DBF would be a standard file type i could find a specific viewer for. I was told it was a file format specific to this app and just accepted it. Thanks for this, i will definitely be checking this out.

                  Terry RT 1 Reply Last reply Reply Quote 1
                  • Stinson's StationersS
                    Stinson's Stationers @Alan Kilborn
                    last edited by

                    @Alan-Kilborn Sorry, yes, i def should have added the after data. here it is:
                    CPIXXXXXXXXXT 2RTXXXXXXFT CPI RXXXXSTREH65 EA EA XXXXX .XXX .XXX .XXX .X N DMXXXXXXXXXXXXXXXXNO UPDATE
                    CPXXXXXXXXXX0RE 3RMXXXXXXXXXE CPI XXXXXXXXX200 EA EA 1XXXX50 1XXXX50 1XXXX60 1XXXXX0 .X N DMXXXXXXXXXXXXXX ACXXXXXXX THXXXXXXXXXTTEN
                    CPXXXXXXXXXXXRE 4RXXXXXXXXXRE CPI FXXXXXXXXXXX EA EA 1XXXXXX 1XXX350 1XXXXX0 1XXXX50 .0 N DXXXXXXXXXXXXXXXXXXXXXXXXXXXTXXNXLXSXRXTXEN
                    CPIXXXXXXXXXXXX 5RMXXXXXXXXXE CPI FUXXXXXXXX03 EA EA 8XXX60 123XXXX 8XXXX0 1XXXX70 .0 N XXXXXXXXXXXXXXXXXXXXXXXXMXRXTXAX XIXXXXXTEN
                    KAXXXXXXXX 6KXXXXXX KAT LXXXXXXXXXXM EA EA 2XXX70 3XXX00 27XXXX 30XXX0 .0 N DXXXXXXXXXXXXXXXXXXXXXX XXRXTXAX XXSXXIXTXN
                    MSXXXXXXXXXXXXX 7XXXXXXXXXX16 MSE LXXXXXXXXXXP EA EA 1XXXX40 19XXX00 XXX00 XXXX .0 N SXXXXXXXXXXXDXSXAXPXIXEXXAXNXXXXXXTE
                    MSXXXXXXXXXXXX 8XXXXXXXXX16 MSE PXXXXXXXX00 EA EA XXXX00 X1XX.X0X XXXXX0 XXXXXX0 .0 N SXXXXXXX XXNX XWXPXRXXEXVAXXXXXXXXTE
                    XXXXXXXXXXXX 91XXXXXXX6 XER XXXXXXXXSER EA EA 13XXXX0 XXXXXX80 XXXXX XXXX XX N XYXNXXXX XEXDXSWXPXXICX XXXXOXUXXXTE
                    MIXXXXXXXXX 10XXXXXXX0 MII GXXXXXXXXXPD BX BX XXXXXX20 XXXXXX20 XXXXX00 XXXX0 .0 N PXIXEXVXRXOXUXXXXXXXX
                    MIXXXXXXXXX 11XXXXXXX1 MII GXXXXXXXXXX BX BX XXXX20 XXXXX20 XXXXX00 XXXX .0 N XXXXXXXXXXXXXXXXTE
                    MIXXXXXXXXX 12XXXXXXX2 MII GXXXXXXXXX BX BX XXXXXX0 XXXXXX0 XXXXX0 XXXXX .0 N PXIXEXVXXNX XXXAXX
                    MIXXXXXXXXX 13XXXXXXX3 MII GXXXXXXXXXXD BX BX XXXXXX XXXXXX XXXX XXX0 .0 N XXXXX VXXXX XXXXXXX
                    MIIPRO31764 1XXXXXXXX4 MII GXXXXXXXXXXD BX BX 4XXXXX 3XXXX0 XXX0 XXXXX0 .0 N XXXXXXXXXXXXXXXXXXXXXXXXXXX

                    1 Reply Last reply Reply Quote 0
                    • Stinson's StationersS
                      Stinson's Stationers @Stinson's Stationers
                      last edited by

                      @Stinson-s-Stationers I realize now this is not as usefel as i’d hoped, because all excess spaces are removed. so you can’t see the space separated column allignment. Sorry about that, i just noticed.

                      Alan KilbornA 1 Reply Last reply Reply Quote 0
                      • Alan KilbornA
                        Alan Kilborn @Stinson's Stationers
                        last edited by

                        @Stinson-s-Stationers

                        Use this when composing and it will put your data in a black box and preserve spacing and other important details

                        99b58856-4df3-469e-857f-cc77357492ec-image.png

                        If you’ve done it right it will appear like this:

                        If you've done it right it will appear like this:
                        
                        1 Reply Last reply Reply Quote 0
                        • Terry RT
                          Terry R @Stinson's Stationers
                          last edited by Terry R

                          @Stinson-s-Stationers said in Adding line breaks to fixed width table:

                          It didn’t even occur to me that DBF would be a standard file type i could find a specific viewer for.

                          Yes, in fact it is one of the oldest file types, first created in in the early 1980s, see here. It is still possible that it doesn’t actually correspond to the acceptable format known, but certainly worth a try using one of the free viewers.

                          File extensions don’t restrict developers to an acceptable format but most will do so. I just feel that using Notepad++ for a task it is not designed for (editing what is essentially a binary file) is looking for trouble. 99% of the time it will work (as this binary file is mostly just the text records with a binary header), but just once you will find your transformation will produce bad data. If you are not doing extensive data checks every transformation, it could have dire consequences.

                          As you say this is company data, so you need to be certain the output is valid. Using the right tools for the job is central to achieving this.

                          Terry

                          PS creating a robust process means it can be easily handled by anyone who can click few buttons,so less chance in the future something could go wrong

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors