Fin/Replace in Determined Lines
- 
 Hi, I need a way to find/replace text ONLY in lines that start for determined string. Ex. key= bla bla 
 value= bla blaReplace “bla” in “blue” ONLY in strings that start for “value=” Can anyone help me? Thank you. 
- 
 in the search box 
 \nvalue=and select radio button extended \n,\r worked for me - this was a DEC EVE feature great to see it in here 
- 
 @Allan-Biggs said: in the search box 
 \nvalue=and select radio button extended \n,\r worked for me - this was a DEC EVE feature great to see it in here Oh just read your post properly - guess that’s not what you want. On Unix you could use grep etc 
- 
 Hello @Fabrizio-Ferraro, sounds like a regex topic but solution depends on how line exactly looks. 
 E.g. from regex point of view it is different if line is value=bla or value = bla.
 So without knowing how the lines are exactly we can only provide a roughly answer like mark regular expression in search mode and search for
 (value=)bla bla and replace with \1blue.Cheers 
 Claudia
- 
 Fabrizio and All, From your post, I tried to find a generic way to achieve this kind of question, with regexes ! Please, just consider my solution as, only, one, among all the possible solutions ! The Fabrizio’s goal is to perform a Search/Replacement on a line, ONLY IF a SPECIFIC condition is true on that particular line I would use the general regex syntax, below : (Regex_Condition)[^@\r\n]*$|(Search_Regex)(?=.*@)|@ (?1$0@)(?2Replacement_Regex)IMPORTANT : - 
Go back to the very beginning of your current file 
- 
In the Replace dialog, check the Regular search mode 
- 
Check, preferably, the Match case option 
- 
Click TWICEon the Replace All button
 NOTES : - 
The arobase character @, is, simply, any single character, which DOES NOT exist in your current file. and preferably, NOT a meta-character of regular expressions. So, according to your file’s contents, you can choose, for instance, the!character, the#character, the%character, the&character, the=character, the_character, …
- 
Regex_Conditionrepresents the regex that satisfies the specific condition, which allows the associated Search/Replacement. Of course,Regex_Conditionmay be, also, a simple literal string, even a single character !
- 
Search_Regexrepresents, of course, the area of text, which will be replaced. As above,Search_Regexmay be, only, a simple literal string, even a single character !
- 
Replacement_Regexis, obviously, the regex to generate the text that will replace the area matched by theSearch_Regex
 
 Below, I’ll expose 3 different examples ( The Fabrizio’s one and two others ) Regex_Condition : ^Value= Search_Regex : \bbla\b Replacement_Regex : blue Regex_Condition : \b\d\d-\d\d-\d\d\b Search_Regex : [a-z] Replacement_Regex : \u\2 Regex_Condition : \d$ Search_Regex : [[:alpha:]]+ Replacement_Regex : <\2>- 
In the first case, we’ll replace the lowercase word bla, with the word blue, ONLY on lines beginning with the exact string Value= 
 ( Fabrizio’s problem )
- 
In the second case, we’ll replace any lowercase letter, with the same uppercase letter, ONLY on lines that contain a date, of the general form xx-xx-xx, at any position of the line 
- 
In the third case, we’ll replace any set of uppercase or lowercase letters, with the same set, surrounded by the two angle brackets, ONLY, if the current line ends with a digit 
 
 To see the results of each example, I’ll use the SAME10 lines test example, below :Value= bla bla testblatest bla That's only "bla bla" speech My NEXT bithday falls on 19-05-16 Every 25-12, Chistmas is celebrated Value= Test of bla and BLA Christmas is celebrated each 25-12 On the 01-01-17, we'll wish a Good New Year Don't change the word "bla", in that TEST line no 8 01-01-00 was the first day OF THAT century Value= bla blabla bla
 So the first example : (^Value=)[^@\r\n]*$|(\bbla\b)(?=.*@)|@ (?1$0@)(?2blue)would give the changed text ( Lines 1, 5 and 10 ), below : Value= blue blue testblatest blue That's only "bla bla" speech My NEXT bithday falls on 19-05-16 Every 25-12, Chistmas is celebrated Value= Test of blue and BLA Christmas is celebrated each 25-12 On the 01-01-17, we'll wish a Good New Year Don't change the word "bla", in that TEST line no 8 01-01-00 was the first day OF THAT century Value= blue blabla blueThe second example : (\b\d\d-\d\d-\d\d\b)[^@\r\n]*$|([a-z])(?=.*@)|@ (?1$0@)(?2\u\2)would give the changed text ( Lines 3, 7 and 9 ), below : Value= bla bla testblatest bla That's only "bla bla" speech MY NEXT BITHDAY FALLS ON 19-05-16 Every 25-12, Chistmas is celebrated Value= Test of bla and BLA Christmas is celebrated each 25-12 ON THE 01-01-17, WE'LL WISH A GOOD NEW YEAR Don't change the word "bla", in that TEST line no 8 01-01-00 WAS THE FIRST DAY OF THAT CENTURY Value= bla blabla blaFinally, the third example : (\d$)[^@\r\n]*$|([[:alpha:]]+)(?=.*@)|@ (?1$0@)(?2<\2>)would give the changed text ( Lines 3, 6 and 8 ), below : Value= bla bla testblatest bla That's only "bla bla" speech <My> <NEXT> <bithday> <falls> <on> 19-05-16 Every 25-12, Chistmas is celebrated Value= Test of bla and BLA <Christmas> <is> <celebrated> <each> 25-12 On the 01-01-17, we'll wish a Good New Year <Don>'<t> <change> <the> <word> "<bla>", <in> <that> <TEST> <line> <no> 8 01-01-00 was the first day OF THAT century Value= bla blabla blaNOTES : - 
Throughout these 3 examples, the lines 2 and 4, which do not begin with the string Value= nor end with a digit and which do not contain any date, remain UNCHANGED 
- 
For a correct behaviour of the proposed regexes, don’t forget to click, TWICE, on the Replace All button
 Best Regards, guy038 P.S. : The underlined idea, about these general regexes, below : (Regex_Condition)[^@\r\n]*$|(Search_Regex)(?=.*@)|@ (?1$0@)(?2Replacement_Regex)is : - 
Add a specific character ( @, or else, not used in current file ) at the end of EACH line that satisfies theRegex_Condition( 1st S/R )
- 
Perform the wanted S/R, ONLY on the lines that end with the @character ( or else ) and finally delete that extra character, at the end of each concerned line ( 2nd S/R )
 As usual, I could give some extra information about these regexes, if needed ! 
- 


