HISE Logo Forum
    • Categories
    • Register
    • Login

    Text Editing Help

    Scheduled Pinned Locked Moved General Questions
    12 Posts 3 Posters 116 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.
    • DanHD
      DanH
      last edited by

      So I've been editing my 1300 User Preset files to update the names of buttons in a plug-in version update. I've made a mistake and now have two buttons with identical names. I didn't notice in time.

      The correct name is on line 107 and the wrong one which I need to change is on line 187 of each preset. Does anyone know of software that can edit only on specific lines?

      No joy with Atom and I've been trying Sublime but I'm not that familiar with it....

      Thanks!

      d.healeyD SimonS 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @DanH
        last edited by

        @DanH said in Text Editing Help:

        The correct name is on line 107 and the wrong one which I need to change is on line 187 of each preset. Does anyone know of software that can edit only on specific lines?

        You can probably do it with Atom/Pulsar or Sublime, but it might not be straightforward. Can you send me the files?

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @d.healey
          last edited by

          @d-healey happily! I'll email you now

          1 Reply Last reply Reply Quote 1
          • d.healeyD
            d.healey
            last edited by

            Got it

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 1
            • SimonS
              Simon @DanH
              last edited by

              @DanH If you're comfortable with the command line, this sounds like a job for sed.

              sed -i '187s/.*/new text here/' filename

              d.healeyD DanHD 3 Replies Last reply Reply Quote 0
              • d.healeyD
                d.healey @Simon
                last edited by

                @Simon Yeah I think sed is the way to go here, but Dan gave me a little more detail in the email and the text isn't always on line 187.

                I think you'd need to modify the command to replace the second instance of Button_SAMPLER_FM_ON with Button_SYNTH_FM_ON in each file. And it needs to search recursively because the presets are organised into subfolders.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                DanHD 1 Reply Last reply Reply Quote 0
                • DanHD
                  DanH @Simon
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • DanHD
                    DanH @d.healey
                    last edited by

                    @d-healey @Simon ok thanks. So sed just replaces the whole line? No need to search for specific text?

                    And what about filename. How do I point it at a file / folder?

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @DanH
                      last edited by

                      @DanH said in Text Editing Help:

                      So sed just replaces the whole line?

                      You can do that or find/replace, up to you.

                      @DanH said in Text Editing Help:

                      And what about filename. How do I point it at a file / folder?

                      You need to use find and pass the result to sed. I'm attempting to put an example together for you.

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Simon
                        last edited by d.healey

                        @Simon Perhaps you can help, my sed foo is failing me.

                        From what I can tell this should be the correct command on Mac (empty quotes after the -i) but it's not working for me. The find works and returns the correct file names, the sed works too, but the combined command doesn't do anything.

                        find . -name "*.preset" -exec sed -i '' "s/Button_SAMPLER_FM_ON/Button_SYNTH_FM_ON/2" {} +

                        @DanH ChatGPT might also be able to help you here, but make a backup of your presets before trusting it.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        DanHD 1 Reply Last reply Reply Quote 0
                        • DanHD
                          DanH @d.healey
                          last edited by

                          @d-healey @Simon the Chat has helped! This is the line:

                          find . -type f -name "*.preset" -exec sed -i '' '187s/Button_SAMPLER_FM_ON/Button_SYNTH_FM_ON/' {} +
                          

                          I think it's just the quotation marks that are wrong! And it's missing the specified line but nt sure of that's what you were going for. Either way thanks for help guys!

                          d.healeyD 1 Reply Last reply Reply Quote 1
                          • d.healeyD
                            d.healey @DanH
                            last edited by

                            @DanH I wasn't specifying the line because you said it could be on either 187 or 188 so I was trying to get it to just always replace the second instance in the file, glad you got a working solution :)

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post

                            30

                            Online

                            1.7k

                            Users

                            11.8k

                            Topics

                            102.8k

                            Posts