Padding out question

Padding out question

6
NewbieNewbie
6

    Nov 16, 2006#1

    Hello - I am using UE32 9.10a
    I am working with a large pipe delimited file and am using the Column>Convert to Fixed Width function.
    I am having trouble with one column where a row of numbers is varying in length between the pipes. The third column should be 16 bytes long.
    Is there anyway I can 'pad' it out so that zero's are inserted at the end of each string of numbers. e.g. this is what i have got at the moment
    10||1234567|||blahblah
    10||123456|||blahblah
    10||123456789|||blahblah

    This is what I want to see
    10||1234567890000000|||blahblah
    10||1234567890000000|||blahblah
    10||1234567890000000|||blahblah

    Any ideas would be great!
    thanks

    6,606548
    Grand MasterGrand Master
    6,606548

      Nov 16, 2006#2

      I guess, you want this result:

      10||1234567000000000|||blahblah
      10||1234560000000000|||blahblah
      10||1234567890000000|||blahblah

      You can do that with a sequence of regular expression search and replaces as following macro shows.

      The macro property Continue if a Find with Replace not found must be checked for this macro.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^10|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^100|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^1000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^10000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^100000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^1000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^10000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^100000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^1000000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^10000000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9][0-9]^)|"
      Replace All "^100000000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9][0-9]^)|"
      Replace All "^1000000000000|"
      Find RegExp "%^(*||[0-9][0-9][0-9]^)|"
      Replace All "^10000000000000|"
      Find RegExp "%^(*||[0-9][0-9]^)|"
      Replace All "^100000000000000|"
      Find RegExp "%^(*||[0-9]^)|"
      Replace All "^1000000000000000|"

      Add UnixReOn at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
      Best regards from an UC/UE/UES for Windows user from Austria

      6
      NewbieNewbie
      6

        Nov 16, 2006#3

        Hey that's great !
        Thank yoU!