Commissario
Hi folks.
I'm not a programmer but I can manage to do many things simply by looking into the command formats and working it out but this is causing me an issue. I'm trying to replace multiple lines in a .js file which have leading spaces but can't manage it with either sed or perl
This is what the source looks like
And this is what I want it to be
I need to change the 000000 to 0000DD, add a new line with lineDash below it and change the width to 2.
I can't just search for 000000 and change it to 0000DD because there are more than one instances of that within the file and the same goes for the width. There is only one instance of var ringStyle so that's the point I have to start with.
I've spent the last couple of hours trying padding the perl command with spaces and using \n for the line separators just to try and get this done but I'm failing badly. I'm sure there's a way to do this but I'm hotspured if I can work it out. I've got the command in a format which doesn't error at me any more but it doesn't actually do anything! Here's what I'm trying (this is a long command with the correct number of spaces). This is just to try and replace the 000000 with 0000DD and then I was going to tack the extra bits on the end.
Can anyone help please? If so, please can you explain the format of the command so I can understand what I'm doing.
Thanks.
I'm not a programmer but I can manage to do many things simply by looking into the command formats and working it out but this is causing me an issue. I'm trying to replace multiple lines in a .js file which have leading spaces but can't manage it with either sed or perl
This is what the source looks like
And this is what I want it to be
I need to change the 000000 to 0000DD, add a new line with lineDash below it and change the width to 2.
I can't just search for 000000 and change it to 0000DD because there are more than one instances of that within the file and the same goes for the width. There is only one instance of var ringStyle so that's the point I have to start with.
I've spent the last couple of hours trying padding the perl command with spaces and using \n for the line separators just to try and get this done but I'm failing badly. I'm sure there's a way to do this but I'm hotspured if I can work it out. I've got the command in a format which doesn't error at me any more but it doesn't actually do anything! Here's what I'm trying (this is a long command with the correct number of spaces). This is just to try and replace the 000000 with 0000DD and then I was going to tack the extra bits on the end.
Code:
sudo perl -i -0 -pe 's/\Q var ringStyle = new ol.style.Style({\n fill: null,\n stroke: new ol.style.Stroke({\n color: '#000000',\n\E/\Q var ringStyle = new ol.style.Style({\n fill: null,\n stroke: new ol.style.Stroke({\n color: '#0000DD',\n\E/g' script.js
Can anyone help please? If so, please can you explain the format of the command so I can understand what I'm doing.
Thanks.