Hi,
Quite new to Ultradit and already dazzled by the possibilities. Helped me already a lot and now I want to dive deeper but got stuck.
I have 2 files, File a with 700 eancodes I want to lookup in file 2. If found then stored in file3 with the results.
I checked the forum, copied and pasted a few things but can't get it working.
The best would be that it runs through the 700 codes in one search.
Please read the readme announcement. It should give you all information you need to know how to write a question which can be answered by the power members. We can't help you further without much more details.
Best regards from an UC/UE/UES for Windows user from Austria
You are right, really unspecified questions can't be answered.
Second try.
I'm working with version 14.10.0.1024
In my 1st file I have lines with a code like this:
#00012#02009780548902424#0221W#0222681#0223ING#02609567092#023032#0232V#0255022008#026525#0266590#02760
#00013#02009780548902424#0236U#0261N#02676#02778894126#0278CB#0916L#04865#028120080711#0282N
My second file contains the codes I want to lookup in the 1st file
9789979316930
9789889900120
9789889900113
9789889899233
9789889839529
9789889809799
The code I am looking for is available in the lines starting with #00012 and #00013 and is always the number after the second #
If found the lines starting with #00012 and #00013 should be copied to a new file or the clipboard so I can store it.
Hopefully this is better explained and can you help me
Okay, now it was no problem to write the macro which works on your example. You need 2 macros because nested loops are not possible. Create first the macro for the inner loop which must be named FindCodeLines and needs the macro property Continue if search string not found checked for this macro. The code for this submacro is very simple:
That macro searches in a loop from top of the file for lines with the code currently stored in user clipboard 9 and collects all found lines in user clipboard 8.
After creating the submacro, create the main macro which needs also the macro property Continue if search string not found checked. I have it named ExtractCodeLines, but the name for this macro is not important. The code is as follows:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Clipboard 8
ClearClipboard
Clipboard 9
SelectAll
Copy
NextWindow
Top
Paste
IfColNumGt 1
"
§
"
Else
"§
"
EndIf
Bottom
IfColNumGt 1
InsertLine
IfColNumGt 1
DeleteToStartofLine
EndIf
EndIf
Top
Loop
IfCharIs "§"
DeleteLine
ExitLoop
EndIf
StartSelect
Key END
Copy
EndSelect
DeleteLine
PlayMacro 1 "FindCodeLines"
Top
EndLoop
ClearClipboard
NewFile
Clipboard 8
Paste
ClearClipboard
Clipboard 0
Top
Key END
IfColNumGt 1
Top
Else
"No line with any of the codes found!"
EndIf
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 macros work only with the Unix regular expression engine because ^c cannot be used in Unix/Perl regex strings.
Best regards from an UC/UE/UES for Windows user from Austria
I tested it on a few records and it works like a charm Only thing now is that I need to find 3000 codes in a file which is 2.8 million records big.....
The macro is running for 8 hours already and still not ready
All I can do is sit and wait
Same as above but for general usage. One file - file A - contains a word list or a list of strings to search for and the second file - file B - is the file with the content. To copy all lines of file B containing one of the strings in file A, you need 2 macros because nested loops are not possible. Create first the macro for the inner loop which must be named FindLines and needs the macro property Continue if search string not found checked for this macro. The code for this submacro is very simple:
That macro searches in a loop from top of the file for lines with the code currently stored in user clipboard 9 and collects all found lines in user clipboard 8. MatchCase MatchWord can be optionally used or not.
After creating the submacro, create the main macro which needs also the macro property Continue if search string not found checked. I have it named ExtractLines, but the name for this macro is not important. The code is as follows:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Clipboard 8
ClearClipboard
Clipboard 9
SelectAll
Copy
NextWindow
Top
Paste
IfColNumGt 1
"
§
"
Else
"§
"
EndIf
Bottom
IfColNumGt 1
InsertLine
IfColNumGt 1
DeleteToStartofLine
EndIf
EndIf
Top
Loop
IfCharIs "§"
DeleteLine
ExitLoop
EndIf
StartSelect
Key END
Copy
EndSelect
DeleteLine
PlayMacro 1 "FindLines"
Top
EndLoop
ClearClipboard
NewFile
Clipboard 8
Paste
ClearClipboard
Clipboard 0
Top
Key END
IfColNumGt 1
Top
Else
"No line with any of the words or strings found!"
EndIf
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.
Best regards from an UC/UE/UES for Windows user from Austria