Hi everyone, I would really appreciate any help I could get on the following topic.
I am not very familiar with reg expressions nor with sed, I just know the basic uses. What I am trying to do is the following: I have a huge text file where I would like to replace all occurnces of a certain pattern with another one. Here an example:
"name1" = "12;15";
"name5" = "7";
"abc1" = "3";
"5" = "";
"-7" = "";
"hgf" = "12;15";
"e1" = "8";
"-5" = "";
Should change to:
"name1" = "12;15";
"name5" = "7";
"abc1" = "3;5;-7";
"hgf" = "12;15";
"e1" = "8;-5";
The rule is: any assign statement to a variable starting with a letter ( like "name1" ) is preserved, while any assignment to a numerical variable ( like "1" or "-1" should be appended to the previous line.
I couldnt get it to work because of the condition is across more than one line. I know I am supposed to use the N instruction but dunno how. Any help how to do the above with sed or any other way is cery appreciated.
Thanks.