Community
    • Login

    Sort Lines acording to another document?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 4 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jacob WiqvistJ
      Jacob Wiqvist @Terry R
      last edited by

      @Terry-R said in Sort Lines acording to another document?:

      @Jacob-Wiqvist said in Sort Lines acording to another document?:

      After that I can run the Compare or ComparePlus and see what numbers that differs

      So is your intention to sort one file the same as another file so you can use the Compare plugin to identify lines/numbers that are missing. Because if that is the real reason, there is very likely a better way of achieving that.

      Terry

      No the line number are not interesting at all, only the parameter after the “line description.

      But I any way want the lines in one file match another file.

      Jacob WiqvistJ 1 Reply Last reply Reply Quote 0
      • Jacob WiqvistJ
        Jacob Wiqvist @Jacob Wiqvist
        last edited by

        @Jacob-Wiqvist

        I tried to apply this:
        menu option Edit -> Line operations -> Sort lines lexicographically

        To bothe files and then apply compare.

        But this did not work as desired.

        The best thing is if I could sort the lines the same as the second document, and select how many letters that should match in the line to move it or something.

        Maybe I am thinking wrong, how to do it.

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Jacob Wiqvist
          last edited by PeterJones

          @Jacob-Wiqvist said in Sort Lines acording to another document?:

          menu option Edit -> Line operations -> Sort lines lexicographically
          To bothe files and then apply compare.
          But this did not work as desired.

          Can you show an example of that “not working as desired”?

          It may be that there’s an option on the Compare Plus plugin you can change (or maybe a feature that exists in Compare Plus that didn’t exist in the original Compare plugin – I know the Compare Plus is better at aligning things than the original Compare was)

          file1:

          six = 6
          four = 4
          two = 2
          seven = 7
          eight = 8
          

          file2:

          one = 0.5 + 0.25 + 0.125 + 0.0625 + ...
          two = 4^0.5
          
          four = two + two
          
          six = (sticks =~ s/t|(cks)/(?1x)/)
          seven = sqrt(fortynine)
          thirtysix = six squared
          

          sorted and compared:
          4e888008-f0ff-4f67-9f03-ca3cd96d5a4f-image.png
          That highlights the exact differences as I would expect. (And that’s with the old Compare plugin) (Okay, technically, I sorted then “removed blank lines” in both files)

          Jacob WiqvistJ 1 Reply Last reply Reply Quote 0
          • Jacob WiqvistJ
            Jacob Wiqvist @PeterJones
            last edited by

            @PeterJones said in Sort Lines acording to another document?:

            @Jacob-Wiqvist said in Sort Lines acording to another document?:

            menu option Edit -> Line operations -> Sort lines lexicographically
            To bothe files and then apply compare.
            But this did not work as desired.

            Can you show an example of that “not working as desired”?

            It may be that there’s an option on the Compare Plus plugin you can change (or maybe a feature that exists in Compare Plus that didn’t exist in the original Compare plugin – I know the Compare Plus is better at aligning things than the original Compare was)

            file1:

            six = 6
            four = 4
            two = 2
            seven = 7
            eight = 8
            

            file2:

            one = 0.5 + 0.25 + 0.125 + 0.0625 + ...
            two = 4^0.5
            
            four = two + two
            
            six = (sticks =~ s/t|(cks)/(?1x)/)
            seven = sqrt(fortynine)
            thirtysix = six squared
            

            sorted and compared:
            4e888008-f0ff-4f67-9f03-ca3cd96d5a4f-image.png
            That highlights the exact differences as I would expect. (And that’s with the old Compare plugin) (Okay, technically, I sorted then “removed blank lines” in both files)

            That is what I wan’t to do automatically!

            If Ther is a program, app , plugin, webpage or anything that can do that I am interested.

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Jacob Wiqvist
              last edited by

              @Jacob-Wiqvist said in Sort Lines acording to another document?:

              That is what I wan’t to do automatically

              There is no plugin that will save you those four menu operations into one. However, I think you can record a macro to do it (on my phone, so cannot test it for you). But sort, remove blank lines, and I believe toggle active view are all macro recordable

              Jacob WiqvistJ 1 Reply Last reply Reply Quote 0
              • Jacob WiqvistJ
                Jacob Wiqvist @PeterJones
                last edited by

                @PeterJones said in Sort Lines acording to another document?:

                @Jacob-Wiqvist said in Sort Lines acording to another document?:

                That is what I wan’t to do automatically

                There is no plugin that will save you those four menu operations into one. However, I think you can record a macro to do it (on my phone, so cannot test it for you). But sort, remove blank lines, and I believe toggle active view are all macro recordable

                What four menu options?

                Did I miss something?

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @Jacob Wiqvist
                  last edited by

                  @Jacob-Wiqvist said in Sort Lines acording to another document?:

                  What four menu options?
                  Did I miss something?

                  I had hoped that my image headers saying “sorted”, and then my later paragraph saying “I sorted then ‘‘removed blank lines’’ in both files” would have communicated that. But to be more explicit:

                  The steps I took in my screenshots on Saturday were:

                  1. Put file1 in view 1 and file2 in view 2; have File 1 active
                  2. Edit > Line Operations > Sort Lexicographically Ascending
                  3. Edit > Line Operations > Remove Empty Lines
                  4. Use F8 (View > Focus on Another View) to make file2 active
                  5. Edit > Line Operations > Sort Lexicographically Ascending
                  6. Edit > Line Operations > Remove Empty Lines
                  7. Plugins > Compare (or Compare Plus) > Compare

                  The “four menu options” I meant were steps 2,3, 5,6.

                  When I tried it out today (now that I’m back on a PC), I found that the View>Focus (F8) is not macro-recordable, though it is macro-playable. I also found that ComparePlus wanted a blank line at the start of both to help it align (even though the older Compare didn’t), so I’ll include it below:

                  The following macro will Sort the active view, Remove Blank Lines in the active view, then add a single blank line to the beginning of that view. Then it will toggle views. Then it will do those three steps on the second view. Once there, it should be ready for you to use Plugins > Compare Plus > Compare.

                          <Macro name="SortAndTrimBothViews" Ctrl="no" Alt="no" Shift="no" Key="0">
                              <Action type="2" message="0" wParam="42059" lParam="0" sParam="" />
                              <Action type="2" message="0" wParam="42055" lParam="0" sParam="" />
                              <Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
                              <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x000D;&#x000A;" />
                              <Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
                              <Action type="2" message="0" wParam="44072" lParam="0" sParam="" />
                              <Action type="2" message="0" wParam="42059" lParam="0" sParam="" />
                              <Action type="2" message="0" wParam="42055" lParam="0" sParam="" />
                              <Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
                              <Action type="1" message="2170" wParam="0" lParam="0" sParam="&#x000D;&#x000A;" />
                              <Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
                          </Macro>
                  
                  1. Open %AppData%\Notepad++\shortcuts.xml
                  2. Paste in the macro into the <Macros> section
                  3. Save shortcuts.xml
                  4. Completely exit Notepad++
                  5. Run Notepad++

                  From now on, Macros > SortAndTrimBothViews will be in your macros menu (and you can use Macro > Modify Shortcut/Delete Macro to add a keyboard shortcut to that macro, if you want). So then the steps for you would be

                  1. Put file1 in view 1 (left)
                  2. Put file2 in view 2 (right)
                  3. Run Macros > SortAndTrimBothViews
                  4. Run Plugins > Compare Plus > Compare
                  Jacob WiqvistJ 1 Reply Last reply Reply Quote 2
                  • Jacob WiqvistJ
                    Jacob Wiqvist @PeterJones
                    last edited by Jacob Wiqvist

                    @PeterJones

                    Extreamly bigg thank you for the efort, I see you have put some time in to this.

                    Unfortunatly it did not work.

                    Her are the 2 exampels from the files I want the lines in"model1" to be orderd after document “model2”

                    [AERODYNAMICS]
                    drag_coef_zero_lift = 0.0205078124 ; The zero lift drag polar
                    drag_coef_flaps = 0.11865233 ; Cd_df Drag Coefficient - Flaps
                    drag_coef_gear = 0.03466797 ; CDg (Drag Coefficient - Landing Gear)
                    drag_coef_spoilers = 0.023464 ; 0.023464 Cd_ds Drag Coefficient - Spoiler
                    drag_coef_air_spoilers = 0.0236436
                    lift_coef_daoa = 2.19384765 ; lift per change in angle of attack rate
                    lift_coef_pitch_rate = -10.4453125 ; The change in lift per change in pitch rate
                    lift_coef_delta_elevator = -0.3583984 ; The change in lift per change in elevator deflection
                    lift_coef_horizontal_incidence = 1.89208984 ; The change in lift per change in horizontal incidence angle
                    lift_coef_flaps = 1.36864 ; Change in lift due to flaps
                    lift_coef_spoilers = -0.0498002 ; Change in lift due to spoilers
                    lift_coef_air_spoilers = -0.049264
                    roll_moment_slip_angle = -0.081964295 ; The change in roll moment per sideslip angle(DIHEDRAL EFFECT)
                    roll_moment_delta_aileron = -0.39990233 ; (control)The change in roll moment per change in aileron deflection
                    roll_moment_delta_rudder = -0.04345704 ; (control)The change in roll moment per change rudder deflection
                    roll_moment_roll_damping = -3.96386717 ; Cl_p Roll Moment - Roll Rate (Damping)
                    roll_moment_yaw_rate = -0.1015623 ; Cl_r Roll Moment - Yaw Rate
                    roll_moment_spoilers = 0.05522 ; The change in roll moment due to spoilers
                    roll_moment_delta_aileron_trim_scalar = -0.00523 ; Change in roll moment due to aileron trim
                    pitch_moment_aoa_0 = -0.11464 ; Pitch moment at zero angle - of - attack
                    pitch_moment_daoa = 0.283220 ; The change in pitch moment per change in angle of attack
                    pitch_moment_delta_elevator = -0.7875936 ; The change in pitch moment per change in elevator deflection
                    pitch_moment_horizontal_incidence = 4.421377 ; The change in pitch moment per change in horizontal incidence angle
                    pitch_moment_pitch_damping = -1464.564 ; The change in pitch moment per change in pitch rate(PRIMARY PITCH STABILITY FACTOR). deg/s
                    pitch_moment_delta_elevator_propwash = -3.64012 ; Cm_dT Pitch Moment - Thrust
                    pitch_moment_pitch_propwash = 0.0 ; Cmq_dT Pitch Damping - Thrust
                    pitch_moment_delta_trim = -3.764022 ; The change in pitch moment per change in trim
                    pitch_moment_flaps = 0.01643210 ; The pitch moment due to flaps
                    pitch_moment_gear = -0.00262042 ; The pitch moment due to gear
                    pitch_moment_spoilers = -0.0595002 ; The pitch moment due to spoilers
                    yaw_moment_slip_angle = 0.288571 ; The change in yaw moment per change sideslip angle(WEATHER VANING EFFECT)
                    yaw_moment_delta_aileron = -0.007324217 ; (adverse yaw)  The change in yaw moment per change aileron deflection
                    yaw_moment_delta_rudder = 0.04886719 ; (control)The change in yaw moment per change in rudder deflection PRIMARY YAW POWER FACTOR
                    yaw_moment_delta_rudder_propwash = 0.0 ; (control)
                    yaw_moment_yaw_propwash = 0.0 ; (damping)
                    yaw_moment_roll = 0.0678712 ; (adverse yaw) The change in yaw moment per change in roll rate deg/s
                    yaw_moment_yaw_damping = -0.896484374 ; (damping)The change in yaw moment per change in yaw rate(PRIMARY YAW STABILITY FACTOR deg/s)
                    yaw_moment_delta_rudder_trim_scalar = 1.123621 ; Change in yaw moment due to rudder trim
                    side_force_slip_angle = -0.1330859377 ; (yaw angle) The change in side force per change in side slip angle
                    side_force_delta_rudder = 0.33150390614 ; The change in side force per change in rudder deflection
                    side_force_roll_rate = 0.089062362 ; (roll velocity)  The change in side force per change in roll rate
                    side_force_yaw_rate = 0.099541314 ; (yaw velocity) The change in side force per change in yaw rate
                    
                    
                    [aerodynamics]
                    //
                    elevator_lift_coef = 1.62 			// EXP WAS 1.80
                    rudder_lift_coef = 1.725			// EXP WAS 1.25
                    aileron_up_drag_coef = 0.45			// EXP WAS 0.5
                    aileron_down_drag_coef = 0.90		// EXP WAS 1.0
                    fuselage_lateral_cx = 0.36			// EXP
                    compute_aero_center=0
                    aero_center_lift=-8.39376
                    presspt_fwd_Alpha0_pMAC=0
                    presspt_fwd_AlphaStall_pMAC=0
                    presspt_fwd_AlphaHiStall_pMAC=-0.25
                    // LIFT COEF
                    lift_coef_at_drag_zero_flaps=0
                    lift_coef_at_drag_zero=0
                    lift_coef_delta_elevator=-0.358398
                    lift_coef_horizontal_incidence=1.891602
                    lift_coef_flaps=1.37843
                    lift_coef_spoilers=-0.05
                    lift_coef_air_spoilers=-0.05
                    // DRAG COEF
                    drag_coef_zero_lift=0.018066
                    drag_coef_flaps=0.117188
                    drag_coef_gear=0.029785
                    drag_coef_spoilers=0.02392
                    drag_coef_air_spoilers=0.02392
                    //
                    side_force_delta_rudder=-0.1743
                    side_force_roll_rate=0.014648
                    side_force_yaw_rate=0
                    side_force_slip_angle=-1.24512 // -0.124512
                    
                    pitch_moment_delta_elevator=-1.391602
                    pitch_moment_delta_trim=-3.525
                    pitch_moment_pitch_damping=-178.222656
                    pitch_moment_aoa_0=0.014648
                    pitch_moment_daoa=9.375977
                    pitch_moment_horizontal_incidence=4.421875
                    pitch_moment_flaps=0.0155
                    pitch_moment_gear=-0.0025
                    pitch_moment_spoilers=0.005
                    pitch_moment_delta_elevator_propwash=0
                    pitch_moment_pitch_propwash=0
                    lift_coef_pitch_rate=-10.449219
                    lift_coef_daoa=2.195801
                    roll_moment_delta_aileron=-0.401855
                    roll_moment_roll_damping=-2.127441
                    roll_moment_yaw_rate=-0.019531
                    roll_moment_delta_rudder=-0.043945
                    roll_moment_slip_angle=0.072266
                    roll_moment_spoilers=0.055
                    roll_moment_delta_aileron_trim_scalar=-0.039247
                    yaw_moment_delta_rudder_trim_scalar=0.017896
                    yaw_moment_roll=0.036621
                    yaw_moment_slip_angle=0.172852
                    yaw_moment_delta_rudder=0.230469
                    yaw_moment_delta_aileron=-0.009766
                    yaw_moment_yaw_damping=-1.171875
                    yaw_moment_delta_rudder_propwash=0
                    yaw_moment_yaw_propwash=0
                    
                    

                    They are totaly diferent but at the same time the same type of parameters.

                    I changed the parameters, copied wrong. It is only a few lines of about 400 lines.

                    PeterJonesP 2 Replies Last reply Reply Quote 0
                    • PeterJonesP
                      PeterJones @Jacob Wiqvist
                      last edited by

                      @Jacob-Wiqvist said in Sort Lines acording to another document?:

                      They are totaly diferent but at the same time the same type of parameters.

                      Just how in the world do you expect to sort model1 according to the order in model2 if model2 and model1 contain no parameters that are the same?

                      Sorry, I cannot help you. Maybe someone else can.

                      1 Reply Last reply Reply Quote 1
                      • PeterJonesP
                        PeterJones @Jacob Wiqvist
                        last edited by PeterJones

                        @Jacob-Wiqvist ,

                        It is considered rude to edit a post after you have received a reply. Because your data now does match, it makes it look like I was wrong when I said your data doesn’t match; but two hours ago, it didn’t match. Now it does.

                        -----

                        If I take the first half of your edited post, and sort it as file1 on the left, and the second half of your edited post, and sort it as file2 on the right, then run ComparePlus > Compare, it properly lines things up. The same would have happened if you used my macro.

                        sorted:
                        4058568a-836a-454e-bf10-7f9e3236bf01-image.png

                        compared:
                        cfab95b7-8b6f-4148-9dba-35a2944cd923-image.png

                        PEBCAK

                        1 Reply Last reply Reply Quote 3
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors