Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #19768
    Mike Fur
    Participant

    e.g. I’d like to search the numbers in “Column 2” against “Column 1” and output what matches.
    I noticed that “multiline” function in EmEditor. However, I am not able to search the numbers in “Column 2” one by one but rather as a whole string.
    Just wondering if anyone has a solution for multiple search? Thanks,

    column 1 column 2
    1 1
    5 2
    8 3
    10 4
    25 5
    29 6
    31 7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31

    #19769
    Yutaka Emura
    Keymaster

    Hello Mike,

    I am not sure exactly what you want to do. Can you show me an example?

    Thank you!

    #19771
    Mike Fur
    Participant

    Hi Thanks for your instant response!
    This would be like a search/find function but it automatically search a list of items one by one in another file instead of enter each item manually.

    For instance:
    1st file:
    ID1 description
    1 absent
    2 present
    3 present
    4 absent
    5 absent
    6 present
    7 present
    8 present
    9 absent
    10 present
    11 present
    12 present
    13 present
    14 absent
    15 absent
    16 present
    17 present
    18 present
    19 present
    20 present
    21 present
    22 absent
    23 absent
    24 absent
    25 absent
    26 absent
    27 absent
    28 absent
    29 absent

    2nd file:
    ID2
    1
    5
    7
    3
    23
    5
    24
    12
    25
    2
    6
    11
    18
    16

    The results:
    1 absent
    5 absent
    7 present
    3 present
    23 absent
    5 absent
    24 absent
    12 present
    25 absent
    2 present
    6 present
    11 present
    18 present
    16 present

    #19772
    Yutaka Emura
    Keymaster

    Hello Mike,

    Thanks for explanation. This is like the JOINT feature of SQL, and I was thinking about this in future versions. Please wait for future versions.

    Meanwhile, you can write a macro like this:

    doc1 = editor.Documents.Item(1);
    doc2 = editor.Documents.Item(2);
    editor.NewFile();
    doc3 = document;
    
    doc1.Activate();
    nLines1 = doc1.GetLines();
    doc2.Activate();
    nLines2 = doc2.GetLines();
    for( y2 = 1; y2 <= nLines2; y2++ ) {
    	doc2.Activate();
    	s2 = doc2.GetLine( y2 );
    	if( s2 == "" ) continue;
    	doc1.Activate();
    	for( y1 = 1; y1 <= nLines1; y1++ ) {
    		s1 = doc1.GetCell( y1, 1, eeCellIncludeNone );
    		if( s1 == "" ) continue;
    		if( s1 == s2 ) {
    			sResult = doc1.GetCell( y1, 2, eeCellIncludeNone );
    			doc3.Activate();
    			doc3.writeln( s2 + "\t" + sResult );
    			break;
    		}
    	}
    }

    Thanks!

    #19773
    Mike Fur
    Participant

    Thanks, Yutaka
    This would be a very useful function in various areas. Hope to use it in the future versions soon!

    #19802
    Yutaka Emura
    Keymaster

    Hello Mike,

    This feature is added now:

    https://www.emeditor.com/forums/topic/emeditor-v14-8-0-beta-1/

    Join CSV feature.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.