• Login
Community
  • Login

Append the values to a text

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
regexregexprefixstring comparestrings
3 Posts 2 Posters 361 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.
  • N
    Nikhil Chavan
    last edited by Mar 25, 2021, 12:40 PM

    Hi All,

    Need a Regex formula for below scenario.

    String:
    /Var/opt/oracle/test/myfile.txt

    Output I want using Regex fomula:
    cp -rp /Var/opt/oracle/test/myfile.txt /Var/opt/oracle/test/myfile.txt_${stamp}

    So basically its copying the whole string twice and prefixing it with "cp -rp " and at the end its appending with “_${stamp}”

    Is is possible to implement in Regex? If yes then It would be very helpful.

    Thanks in advance,
    Nikhil Chavan

    1 Reply Last reply Reply Quote 0
    • E
      Ekopalypse
      last edited by Mar 25, 2021, 12:49 PM

      @Nikhil-Chavan said in Append the values to a text:

      cp -rp /Var/opt/oracle/test/myfile.txt /Var/opt/oracle/test/myfile.txt_${stamp}

      I assume you do have a file with each line being a path to a file,
      if so then
      find what: ^.+$
      replace with: cp -rp $0 $0_${stamp}

      N 1 Reply Last reply Mar 25, 2021, 1:26 PM Reply Quote 3
      • N
        Nikhil Chavan @Ekopalypse
        last edited by Mar 25, 2021, 1:26 PM

        @Ekopalypse Superb!! Thanks alot! It worked… :)

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