Community
    • Login

    Any Help Appreciated.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    10 Posts 5 Posters 755 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.
    • Cal MurphyC
      Cal Murphy
      last edited by PeterJones

      First of all thanks for reading my question

      I would appreciate any help…

      Iv’e been ripping my cd collection for years and overtime i have used the same software but i want some help in changing the log file.

      this is a example of a log file

      Track 1:  Ripped LBA 0 to 21675 (4:49) in 0:15. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Black - 01 - Wonderful Life.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 5ECA8BDA     AccurateRip CRC: 7A8AD196     [DiscID: 019-00368714-02f6684c-1e124413-1]
        AccurateRip Verified Confidence 2 [CRCv1 7a8ad196]
      
      Track 2:  Ripped LBA 21675 to 41341 (4:22) in 0:12. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\ABC - 02 - When Smokey Sings.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 3FCED021     AccurateRip CRC: 15EF2440     [DiscID: 019-00368714-02f6684c-1e124413-2]
        AccurateRip Verified Confidence 2 [CRCv1 15ef2440]
      
      Track 3:  Ripped LBA 41341 to 59417 (4:01) in 0:10. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Curiosity Killed the Cat - 03 - Misfit.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 75671085     AccurateRip CRC: 99C6073E     [DiscID: 019-00368714-02f6684c-1e124413-3]
        AccurateRip Verified Confidence 2 [CRCv1 99c6073e]
      

      Now what i need is this section of text deleting

       (4:49) in 0:15
       (4:22) in 0:12
       (4:01) in 0:10
      

      so it would become

      rack 1:  Ripped LBA 0 to 21675 (4:49) in 0:15. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Black - 01 - Wonderful Life.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 5ECA8BDA     AccurateRip CRC: 7A8AD196     [DiscID: 019-00368714-02f6684c-1e124413-1]
        AccurateRip Verified Confidence 2 [CRCv1 7a8ad196]
      
      Track 2:  Ripped LBA 21675 to 41341. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\ABC - 02 - When Smokey Sings.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 3FCED021     AccurateRip CRC: 15EF2440     [DiscID: 019-00368714-02f6684c-1e124413-2]
        AccurateRip Verified Confidence 2 [CRCv1 15ef2440]
      
      Track 3:  Ripped LBA 41341 to 59417. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Curiosity Killed the Cat - 03 - Misfit.flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 75671085     AccurateRip CRC: 99C6073E     [DiscID: 019-00368714-02f6684c-1e124413-3]
        AccurateRip Verified Confidence 2 [CRCv1 99c6073e]
      

      Also file of the log files are like this they have the duration repeated at the end, if this exists i would like it deleted as well…

      Track 1:  Ripped LBA 0 to 21675 (4:49) in 0:15. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Black - 01 - Wonderful Life (4:49).flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 5ECA8BDA     AccurateRip CRC: 7A8AD196     [DiscID: 019-00368714-02f6684c-1e124413-1]
        AccurateRip Verified Confidence 2 [CRCv1 7a8ad196]
      
      Track 2:  Ripped LBA 21675 to 41341 (4:22) in 0:12. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\ABC - 02 - When Smokey Sings (4:22).flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 3FCED021     AccurateRip CRC: 15EF2440     [DiscID: 019-00368714-02f6684c-1e124413-2]
        AccurateRip Verified Confidence 2 [CRCv1 15ef2440]
      
      Track 3:  Ripped LBA 41341 to 59417 (4:01) in 0:10. Filename: C:\Users\Owner\Desktop\Rip\Class Of... 1987 - (544 658-2) - (COMP)\Curiosity Killed the Cat - 03 - Misfit (4:01).flac
        AccurateRip: Accurate (confidence 2)     [Pass 1]
        CRC32: 75671085     AccurateRip CRC: 99C6073E     [DiscID: 019-00368714-02f6684c-1e124413-3]
        AccurateRip Verified Confidence 2 [CRCv1 99c6073e]
      

      Thankyou for any help.

      —

      moderator added code markdown around text; please don’t forget to use the </> button to mark example text as “code” so that characters don’t get changed by the forum

      Terry RT PeterJonesP 2 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @Cal Murphy
        last edited by Terry R

        @Cal-Murphy said in Any Help Appreciated.:

        but i want some help in changing the log file.

        Given the examples provided I feel confident this will help you. It uses the Replace function and the search mode is set to regular expression. Just copy and paste the red text below into the “Find What” field in the Replace function window, note the “Replace With” field needs to be empty!
        Find What: \(\d*:\d*\)((?=\.)| in \d*:\d*)
        Replace With: nothing in this field, this effectively eliminates any selected text (deletes it).

        By all means use the “Replace” button just so you can see for the first few records what it is doing. Otherwise click on “Replace All”.

        Terry

        1 Reply Last reply Reply Quote 3
        • PeterJonesP
          PeterJones @Cal Murphy
          last edited by

          @Cal-Murphy said in Any Help Appreciated.:

          Now what i need is this section of text deleting
          Also file of the log files are like this they have the duration repeated at the end, if this exists i would like it deleted as well…

          Using Regular Expression mode, it’s doable.

          FIND WHAT = (?-s)\h*(\(\d+:\d+\)) in \d+:\d+(.*?)(\h*\1)?(?=\.flac)
          REPLACE WITH = $2
          SEARCH MODE = Regular Expression

          It will look for (##:##) in ##:## on a line, possibly ending by the stuff from the original parentheses just before the .flac … It will replace it without the (##:##) in ##:## , and if the .flac had the second timestamp, the second timestamp would be removed, too.

          Concepts involved (all of which you can find in the User Manual links below):

          • (?-s) = makes sure . doesn’t match newline characters
          • \h* = zero or more spaces or tabs
          • (...) = creates a capture group: there are two in there: the first captures the timestamp in literal parentheses into group#1, the second captures the text after (##:##) in ##:## nearly to the end of the line
          • \( and \) = literal parentheses, since parentheses without \ before them have special meaning to the regex
          • \d+ = matches one or more digits
          • (.*?) = puts 0 or more characters into the group (in this case, group 2)
          • (\h*\1)? = matches zero or one instance of spaces followed the same text that was already put into group #1 – ie, be the same parentheses-timestamp as earlier on the line
          • (?=\.flac) a “lookahead” for \.flac – this prevents the .flac from being part of group#2
          • replace with: $2 replaces all the text from the start of the match to the end with just the contents of group#2. In your case, that’s the period after the main match, all the way to what was just before .flac, possibly excluding the second timestamp if it was there.

          Terry beat me to some of it, but mine’s slightly different, because it requires the first timestamp to match the timestamp just before .flac . (I would’ve just let his sit as sufficient, if I hadn’t already figured out my regex and described most of it.)

          ----

          Useful References

          • Please Read Before Posting
          • Template for Search/Replace Questions
          • Formatting Forum Posts
          • Notepad++ Online User Manual: Searching/Regex
          • FAQ: Where to find other regular expressions (regex) documentation
          1 Reply Last reply Reply Quote 3
          • guy038G
            guy038
            last edited by guy038

            Hello, @cal-Murphy, @terry-r, @peterjones and All,

            Oh…, my god : two well_known posters have already answered you some good solutions !

            I’m a bit late but, here is my own solution, as well.Now, you just have the difficulty to choose ;-))


            • So, open your file in Notepad++

            • Open the Replace dialog ( Ctrl + H )

              • SEARCH (?x-is) \x20 \( .+ (?= \. \x20 Filename ) | \x20 \( [^(\r\n]+ (?= \. flac )

              • REPLACE Leave EMPTY

              • Un-tick all BOX options

              • Tick the Wrap around option

              • Select the Regular expression search mode

              • Click once the Replace All button or several times on the Replace button

            • Close the Replace dialog ( Esc )

            • Save the changes ( Ctrl + S )

            Here you are !


            NOTES : Because of the alternation symbol |, this regex S/R searches, either for :

            • A space char followed with an opening ( and some chars ONLY IF it is followed with the string . Filename, with that exact case

            • A space char followed with an opening ( and some chars, different from an opening ( and EOL chars, ONLY IF it is followed with the string .flac, with that exact case

            • As the replacement zone is empty the searched zones are simply deleted

            Best Regards

            guy038

            Cal MurphyC Terry RT 2 Replies Last reply Reply Quote 2
            • Cal MurphyC
              Cal Murphy @guy038
              last edited by

              Thank you for the replies, i haven’t tried any yet, due to not being at the pc with the files on etc, but no doubt one if not all will work, thank you so much.

              1 Reply Last reply Reply Quote 1
              • Terry RT
                Terry R @guy038
                last edited by Terry R

                @guy038 said in Any Help Appreciated.:

                SEARCH (?x-is)

                I notice a lot (if not all) of your regexes these days use the x modifier. I wonder if; when using that; it would also be useful to add in a note explaining what this means.

                Obviously for experienced regex users we understand but for the new regex users this may be a bit confusing as white-space can mean 2 things depending on if it is escaped or not, although I do see you use \x20 to differentiate them.

                As I say, just a thought.

                Terry

                1 Reply Last reply Reply Quote 2
                • guy038G
                  guy038
                  last edited by guy038

                  Hi, @cal-murphy, @terry-r, @peterjones and All,

                  Indeed, Terry, you’re right about it ! So, I created a new post, in the General Discussion section, which recapitulates the main points to understand, concerning the free-spacing mode (?x)

                  So, @cal-murphy, refer to the link below, for further info :

                  https://community.notepad-plus-plus.org/post/90086

                  BR

                  guy038

                  Cal MurphyC 1 Reply Last reply Reply Quote 2
                  • Cal MurphyC
                    Cal Murphy @guy038
                    last edited by

                    Thankyou, i have tried them all and they all work, much appreciated, i will check out and read the info given.

                    Alan KilbornA 1 Reply Last reply Reply Quote 2
                    • Alan KilbornA
                      Alan Kilborn @Cal Murphy
                      last edited by Alan Kilborn

                      We should keep in mind that “free spacing” mode doesn’t always make things clearer. For example, in the regex here, I think it is clearer without it:

                      (?-is) \(.+(?=\. Filename)| \([^(\r\n]+(?=\.flac)

                      Part of the “problem” is that a true space in the regex becomes fairly “ugly” in this mode: \x20

                      It’s a personal choice.


                      When coupling the above with the fact that “free spacing” mode has problems depending on what type of search you are doing (see “it will fail…” HERE ), IMO it is best to avoid it (at least until the bugs are fixed).

                      1 Reply Last reply Reply Quote 0
                      • guy038G
                        guy038
                        last edited by guy038

                        Hello, @cal-Murphy, @terry-r, @peterjones, @alan-kilborn and All,

                        Yes, Alan, I must admin that this syntax is really confusing for most people and doesn’t provide a sustential benefit, unless you use this particular syntax below :

                        SEARCH (?x-is) \x20 (?# SPACE char ) \( (?# OPENING Paren. ) .+ (?# Some STANDARD chars) (?= \. [ ]Filename ) (?# ONLY IF '. Filename' after ) | (?# OR ) \x20 (?# SPACE char ) \( (?# OPENING Paren. ) [^(\r\n]+ (?# some NOT PAREN. chars ) (?= \. flac ) (?# ONLY IF '.flac' after )

                        Note that I still use the \x20 syntax because the [ ] syntax does not work in this forum ??

                        However, I kept my free-spacing regex as a single line to avoid the multi-lines bug in some cases !


                        BTW, @cal-murphy, do you remember that you asked us, six months ago, about a similar problem, which was relative to the same bunch of data !

                        Refer to :    https://community.notepad-plus-plus.org/topic/24415/copy-then-paste-elsewhere

                        Cheers,

                        guy038

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