How to detect and fix wrong line breaks?

How to detect and fix wrong line breaks?

1
NewbieNewbie
1

    Jul 24, 2007#1

    Hello,

    I have some problem with Log files where the layout is not good.

    In fact, i will have Date / Time at the beginning of each line like this :

    2007/07/24 07:05 : Comment / parameter / ...
    2007/07/24 07:05 : Comment / parameter / ...
    2007/07/24 07:05 : Comment / parameter / ...

    But sometimes in my logs i've this :
    2007/07/24 07:05 : Comment / parameter / ...
    2007/07/24 07:05 :
    Comment / parameter / ...
    2007/07/24 07:05 : Comment / parameter / ...

    What i want to do is to modify the layout to have date / time at each line.
    (More easy to read :roll: )

    I have think of this solution :
    Go to the beginning of each line
    If the "first" characters are not 2007/07 (parameter ? :P )
    Do Key BACKSPACE
    Else goto next line

    My problem is : how to search 2007/07 ? :oops:

    Thanx for you help and your courage to read me so far :?

    6,681583
    Grand MasterGrand Master
    6,681583

      Jul 24, 2007#2

      Run this macro with macro property Continue if a Find with Replace not found checked:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      Find RegExp "%#"
      Replace All "MaRkEdChAr"
      Find RegExp "%^(20[0-9][0-9]/[01][0-9]/[0-3][0-9]^)"
      Replace All "#^1"
      Find RegExp "^p^([~#]^)"
      Replace All "^1"
      Find RegExp "%#"
      Replace All ""
      Find MatchCase "MaRkEdChAr"
      Replace All "#"

      Add UnixReOn or PerlReOn (v12+ of UE) 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.

      The macro first searches for '#' at start of any line and replaces it with strange string "MaRkEdChAr".

      Next the macro marks all lines with '#' at start of the line which starts with 20yy/mm/dd.

      Then the macro deletes all DOS line terminations (CR+LF) where the next character is not '#'.

      Last the inserted '#' at start of every line with a date is removed and every strange string "MaRkEdChAr" is replaced back to '#'.
      Best regards from an UC/UE/UES for Windows user from Austria