How to use notepad ++ to add text to the beginning of a certain line (for example, line 3) in several files?

With Notepad ++, how can I add text to the beginning of a specific line (like line 3) in multiple files?

Consider the following file structure:

File1:
this.is.the.first.key=blah
me.is.second=blahblah
blahblahblah
i.is.fourth=blahblahblahblah
j=sok
i=oakfoasskf
o=sdofkogdk
this is missing a variable

This structure exists in several files, each of which contains the same keys (or missing keys), while the values ​​are translated according to the file name (one file is _en, the other is _de, etc.). I want to add keys to all lines that they are missing

(I saw a lot of answers that suggested using RegEx to select strings, but there was nothing about choosing a specific row ).

+2
source share
1

Notepad ++

: ^([^=]*)(?!=)$

: KEY=$1

, , " " "".


DEMO.

, =.

:

  ^                        the beginning of the string
  (                        group and capture to \1:
    [^=]*                    any character except: '=' (0 or more times)
  )                        end of \1

  (?!                      look ahead to see if there is not:
    =                        '='
  )                        end of look-ahead
  $                        before an optional \n, and the end of the string
0

Source: https://habr.com/ru/post/1624074/


All Articles