search down, search up, select line, copy to another file

search down, search up, select line, copy to another file

2
NewbieNewbie
2

    Feb 21, 2006#1

    Hi all, I need to do this: i must search "2 NOTE di ". When I find it, I must search up the text "0 @", copy all the line and paste in a new file. My 333000 lines sample text is this:

    ...........
    0 @I13507@ INDI
    1 NAME Maria Antonia /Agnoli/
    2 GIVN Maria Antonia
    2 SURN Agnoli
    2 _MARNM Maria Antonia /Chiamulera/
    1 SEX F
    1 CHAN
    2 DATE 07 Dec 2005
    3 TIME 15:28:59
    1 FAMS @F4234@
    1 BIRT
    2 DATE 01 JAN 1740
    2 PLAC Valle (BL)
    1 DEAT
    2 DATE 19 may 1792
    2 PLAC Valle (BL)
    1 FAMC @F5932@
    0 @I13385@ INDI
    1 NAME Antonia /Agnoli/
    2 GIVN Antonia
    2 SURN Agnoli
    2 _MARNM Antonia /Da Giau/
    1 SEX F
    1 CHAN
    2 DATE 28 Oct 2005
    3 TIME 18:33:19
    1 FAMS @F4200@
    1 BIRT
    2 NOTE di Gaspare di Vallesina e di Bartolomea
    2 DATE 26 DEC 1713
    2 PLAC Valle (BL)
    1 DEAT
    2 DATE 11 apr 1788
    2 PLAC Valle (BL)
    1 FAMC @F5955@
    0 @I8797@ INDI
    1 NAME Maria /Ciarloni/
    2 GIVN Maria
    2 SURN Ciarloni
    2 _MARNM Maria /Baioni/
    1 SEX F
    1 FAMS @F2721@
    1 BIRT
    2 NOTE di Pietro
    0 @I8793@ INDI
    1 NAME Palma /Ciarloni/
    2 GIVN Palma
    2 SURN Ciarloni
    1 SEX F
    1 BIRT
    2 DATE 9 oct 1827
    2 PLAC Mondolfo (PU)
    2 NOTE di Pietro (Scapezzano 29/10/1775-Mondolfo 4/9/1848) e Domenica Bacianini
    1 FAMS @F2720@
    ........

    I would like to have in a new file:

    .......
    0 @I13385@ INDI
    0 @I8797@ INDI
    .......

    Thanks all
    Max

    6,686585
    Grand MasterGrand Master
    6,686585

      Feb 22, 2006#2

      No problem! Here is the macro:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 9
      ClearClipboard
      Top
      Loop
      Find MatchCase RegExp "%2 NOTE di "
      IfNotFound
      ExitLoop
      Else
      Find MatchCase RegExp Up "%0 @*^p"
      IfFound
      CopyAppend
      EndIf
      Find MatchCase RegExp "%2 NOTE di "
      EndIf
      EndLoop
      NewFile
      Paste
      Top
      ClearClipboard
      Clipboard 0
      UnixReOn

      Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style.
      For UltraEdit v11.10c and lower see Advanced - Configuration - Find - Unix style Regular Expressions.
      For UltraEdit v11.20 and higher see Advanced - Configuration - Searching - Unix style Regular Expressions.
      Macro commands UnixReOn/UnixReOff modifies this setting.

      And don't forget to enable the macro property Continue if a Find with Replace not found.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Re: search down, search up, select line, copy to another fil

        Feb 23, 2006#3

        I have just tried it. MARVELLOUS, thanks. You make me save a week of my life.

        Just one thing: I have UE 8.10b, and it gave me an error on ClearClipboard. I cut the lines, and everything works well.

        Thanks again,
        Max