• Login
Community
  • Login

How to remove all lines before the first : if there are 2 :'s in the file?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 3 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.
  • A
    AveravaDevs
    last edited by Aug 11, 2018, 10:27 PM

    Example:

    hello:pig:cake

    I would like to remove the hello from all the lines

    1 Reply Last reply Reply Quote 0
    • T
      Terry R
      last edited by Aug 11, 2018, 11:03 PM

      Have you tried to create an expression yet? In Ñotepad++ you can use a normal replace using that word, in the replace field you would have nothing. In effect you are deleting that word.

      I do wonder though, given the title of your question, the content differs from that so maybe you meant to ask something else?

      Terry

      1 Reply Last reply Reply Quote 1
      • P
        PeterJones
        last edited by Aug 11, 2018, 11:06 PM

        Your subject line and the example are not specific enough, and possibly contradict each other:

        The subject says you want to remove all lines before the first : in the file if there are two :s in the file. That would say that

        first line
        second line
        hello :
        second : here
        

        would become

        hello :
        second : here
        

        But your example doesn’t seem to agree.

        Based on your example, I assume you want something like:

        hello:pig:cake
        hello;pig;cake -- note, this line is semicolons, not colons
        hello:pig:cake
        

        to become

        :pig:cake
        hello;pig;cake -- note, this line is semicolons, not colons
        :pig:cake
        

        Could you please give a bigger example document, showing us both the before and after? (To include your text verbatim, as I have, prefix every line in the text by 4 spaces, with a blank line before and after)

        Also, show what you tried.

        this faq will give you a good start on regular expressions.

        If you give a fuller explanation of what you want, and some indication that you’re willing to put in effort and learn, you’ll probably get one or more answers in short order. (Though it’s the weekend, so “short order” might be Monday. Ahh, @Terry-R showed up, so you might even get it sooner. Depends on who’s around when you clarify things.)

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