sed + add word before string only if not existssed + remove char after specific wordAdd text before last matched occurrence of search word in a fileAdd specific word to each linePrint line only if the upper line include specific wordGrep for word stem and print only word (and not line)how to add string if word ended with specific stringsed + mark line in case of marched wordawk + append lines before captured word only if lines are not defined in the fileHow to add properties in the end of the two first lines with double quote?add backslash before specific character
How do I turn off a repeating trade?
Impossible darts scores
How long would it take to cross the Channel in 1890's?
What are the penalties for overstaying in USA?
Find the probability that the 8th woman to appear is in 17th position.
Find the C-factor of a vote
Where can I find a database of galactic spectra?
Suggested order for Amazon Prime Doctor Who series
How to get cool night-vision without lame drawbacks?
Employer wants to use my work email account after I quit
Unusual mail headers, evidence of an attempted attack. Have I been pwned?
How do I respond to requests for a "guarantee" not to leave after a few months?
Is this one of the engines from the 9/11 aircraft?
3D Crossword, Cryptic, Statue View & Maze
Are all instances of trolls turning to stone ultimately references back to Tolkien?
C-152 carb heat on before landing in hot weather?
Is there a way to split the metadata to custom folders?
Should I prioritize my 401(k) over my student loans?
Does Marvel have an equivalent of the Green Lantern?
Hand soldering SMD 1206 components
How to make clear to people I don't want to answer their "Where are you from?" question?
Archery in modern conflicts
Fill NAs in R with zero if the next valid data point is more than 2 intervals away
Cascading Repair Costs following Blown Head Gasket on a 2004 Subaru Outback
sed + add word before string only if not exists
sed + remove char after specific wordAdd text before last matched occurrence of search word in a fileAdd specific word to each linePrint line only if the upper line include specific wordGrep for word stem and print only word (and not line)how to add string if word ended with specific stringsed + mark line in case of marched wordawk + append lines before captured word only if lines are not defined in the fileHow to add properties in the end of the two first lines with double quote?add backslash before specific character
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
We have the following line in a file on Linux:
discovery.uri=http://master.navada.com:8800
we want to add the word koko
before master
, so I just do:
sed –i 's/master/kokomaster/' file
which gives:
discovery.uri=http://kokomaster.navada.com:8800
but what we want is to add koko
only if koko
isn't already present before master
.
For example, the next time that we run
sed –i 's/master/kokomaster/' file
the line will be:
discovery.uri=http://kokokokomaster.navada.com:8800
text-processing sed configuration
add a comment |
We have the following line in a file on Linux:
discovery.uri=http://master.navada.com:8800
we want to add the word koko
before master
, so I just do:
sed –i 's/master/kokomaster/' file
which gives:
discovery.uri=http://kokomaster.navada.com:8800
but what we want is to add koko
only if koko
isn't already present before master
.
For example, the next time that we run
sed –i 's/master/kokomaster/' file
the line will be:
discovery.uri=http://kokokokomaster.navada.com:8800
text-processing sed configuration
add a comment |
We have the following line in a file on Linux:
discovery.uri=http://master.navada.com:8800
we want to add the word koko
before master
, so I just do:
sed –i 's/master/kokomaster/' file
which gives:
discovery.uri=http://kokomaster.navada.com:8800
but what we want is to add koko
only if koko
isn't already present before master
.
For example, the next time that we run
sed –i 's/master/kokomaster/' file
the line will be:
discovery.uri=http://kokokokomaster.navada.com:8800
text-processing sed configuration
We have the following line in a file on Linux:
discovery.uri=http://master.navada.com:8800
we want to add the word koko
before master
, so I just do:
sed –i 's/master/kokomaster/' file
which gives:
discovery.uri=http://kokomaster.navada.com:8800
but what we want is to add koko
only if koko
isn't already present before master
.
For example, the next time that we run
sed –i 's/master/kokomaster/' file
the line will be:
discovery.uri=http://kokokokomaster.navada.com:8800
text-processing sed configuration
text-processing sed configuration
edited Jun 6 at 13:27
terdon♦
137k33 gold badges283 silver badges459 bronze badges
137k33 gold badges283 silver badges459 bronze badges
asked Jun 6 at 12:12
yaelyael
2,9028 gold badges39 silver badges87 bronze badges
2,9028 gold badges39 silver badges87 bronze badges
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
You can replace a bit more to avoid this problem:
sed -i sX/masterX/kokomasterX file
This replaces “/master”, so the next time you run it, nothing will be replaced, since “/kokomaster” doesn’t match.
add a comment |
sed -i '/kokomaster/!s/master/koko&/' file
First test whether the string kokomaster
exists on the line, and if it doesn't, do the substitution. This is almost a literal translation of "but what we want is to add the koko
word only if koko
not exists before master
word" into sed
.
The &
in the replacement part of the substitution will be replaced by the text matched by the pattern part (i.e. master
).
After reading the comments (see below), you may want to use something more specific that would actually only modify the server name portion of the URI, and not any master
string elsewhere, even if kokomaster
occurred (or not) in the URI path:
sed -i 's,^(discovery.uri=http://)(master),1koko2,' file
You may even want to go as far as matching the exact and full line that you'd want to replace, just to avoid even hypothetical mistakes:
sed -i 's,^(discovery.uri=http://)(master.navada.com:8800)$,1koko2,' file
If the configuration file is written in JSON or some other well know format, you would not use sed
at all, but jq
or some other apropriate tool specifically written for handling files of that format.
1
That wouldn't work ondiscovery.uri=http://master.navada.com:8800/kokomaster
though.
– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. Indiscovery.uri=http://master.navada.com:8800/kokomaster
, there's nokoko
before the firstmaster
. Yet, thatsed
line doesn't add one.
– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the stringkoko
does not already occur beforemaster
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string,koko
already occurs right beforemaster
, so it's not added again.
– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. Themaster
in the server name needs to be replaced even if there may be somekokomaster
in the path. Pedanticly. I guess the OP doesn't care.
– Philippos
Jun 6 at 16:32
|
show 2 more comments
Use
sed 's/(koko)*master/kokomaster/'
so master
and any number of preceeding koko
s get replaced.
Or better,sed 's/(koko)0,1master/kokomaster/'
to avoid replacingkokokokomaster
withkokomaster
.
– Stéphane Chazelas
Jun 6 at 13:52
add a comment |
If you're open to other tools:
perl -i -pe 's/(?<!koko)master/kokomaster/' file
The (?>!foo)
is a negative lookbehind, so (?<!koko)master
will only match master
when not preceded by koko
.
add a comment |
I have used below awk command to do the same
command
awk '$0 !~/kokomaster/gsub("master","kokomaster",$0)1' filename >file_tmp && mv file_tmp filename
output
discovery.uri=http://kokomaster.navada.com:8800
discovery.uri=http://kokomaster.navada.com:8800
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f523302%2fsed-add-word-before-string-only-if-not-exists%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can replace a bit more to avoid this problem:
sed -i sX/masterX/kokomasterX file
This replaces “/master”, so the next time you run it, nothing will be replaced, since “/kokomaster” doesn’t match.
add a comment |
You can replace a bit more to avoid this problem:
sed -i sX/masterX/kokomasterX file
This replaces “/master”, so the next time you run it, nothing will be replaced, since “/kokomaster” doesn’t match.
add a comment |
You can replace a bit more to avoid this problem:
sed -i sX/masterX/kokomasterX file
This replaces “/master”, so the next time you run it, nothing will be replaced, since “/kokomaster” doesn’t match.
You can replace a bit more to avoid this problem:
sed -i sX/masterX/kokomasterX file
This replaces “/master”, so the next time you run it, nothing will be replaced, since “/kokomaster” doesn’t match.
answered Jun 6 at 12:15
Stephen KittStephen Kitt
191k26 gold badges457 silver badges528 bronze badges
191k26 gold badges457 silver badges528 bronze badges
add a comment |
add a comment |
sed -i '/kokomaster/!s/master/koko&/' file
First test whether the string kokomaster
exists on the line, and if it doesn't, do the substitution. This is almost a literal translation of "but what we want is to add the koko
word only if koko
not exists before master
word" into sed
.
The &
in the replacement part of the substitution will be replaced by the text matched by the pattern part (i.e. master
).
After reading the comments (see below), you may want to use something more specific that would actually only modify the server name portion of the URI, and not any master
string elsewhere, even if kokomaster
occurred (or not) in the URI path:
sed -i 's,^(discovery.uri=http://)(master),1koko2,' file
You may even want to go as far as matching the exact and full line that you'd want to replace, just to avoid even hypothetical mistakes:
sed -i 's,^(discovery.uri=http://)(master.navada.com:8800)$,1koko2,' file
If the configuration file is written in JSON or some other well know format, you would not use sed
at all, but jq
or some other apropriate tool specifically written for handling files of that format.
1
That wouldn't work ondiscovery.uri=http://master.navada.com:8800/kokomaster
though.
– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. Indiscovery.uri=http://master.navada.com:8800/kokomaster
, there's nokoko
before the firstmaster
. Yet, thatsed
line doesn't add one.
– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the stringkoko
does not already occur beforemaster
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string,koko
already occurs right beforemaster
, so it's not added again.
– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. Themaster
in the server name needs to be replaced even if there may be somekokomaster
in the path. Pedanticly. I guess the OP doesn't care.
– Philippos
Jun 6 at 16:32
|
show 2 more comments
sed -i '/kokomaster/!s/master/koko&/' file
First test whether the string kokomaster
exists on the line, and if it doesn't, do the substitution. This is almost a literal translation of "but what we want is to add the koko
word only if koko
not exists before master
word" into sed
.
The &
in the replacement part of the substitution will be replaced by the text matched by the pattern part (i.e. master
).
After reading the comments (see below), you may want to use something more specific that would actually only modify the server name portion of the URI, and not any master
string elsewhere, even if kokomaster
occurred (or not) in the URI path:
sed -i 's,^(discovery.uri=http://)(master),1koko2,' file
You may even want to go as far as matching the exact and full line that you'd want to replace, just to avoid even hypothetical mistakes:
sed -i 's,^(discovery.uri=http://)(master.navada.com:8800)$,1koko2,' file
If the configuration file is written in JSON or some other well know format, you would not use sed
at all, but jq
or some other apropriate tool specifically written for handling files of that format.
1
That wouldn't work ondiscovery.uri=http://master.navada.com:8800/kokomaster
though.
– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. Indiscovery.uri=http://master.navada.com:8800/kokomaster
, there's nokoko
before the firstmaster
. Yet, thatsed
line doesn't add one.
– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the stringkoko
does not already occur beforemaster
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string,koko
already occurs right beforemaster
, so it's not added again.
– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. Themaster
in the server name needs to be replaced even if there may be somekokomaster
in the path. Pedanticly. I guess the OP doesn't care.
– Philippos
Jun 6 at 16:32
|
show 2 more comments
sed -i '/kokomaster/!s/master/koko&/' file
First test whether the string kokomaster
exists on the line, and if it doesn't, do the substitution. This is almost a literal translation of "but what we want is to add the koko
word only if koko
not exists before master
word" into sed
.
The &
in the replacement part of the substitution will be replaced by the text matched by the pattern part (i.e. master
).
After reading the comments (see below), you may want to use something more specific that would actually only modify the server name portion of the URI, and not any master
string elsewhere, even if kokomaster
occurred (or not) in the URI path:
sed -i 's,^(discovery.uri=http://)(master),1koko2,' file
You may even want to go as far as matching the exact and full line that you'd want to replace, just to avoid even hypothetical mistakes:
sed -i 's,^(discovery.uri=http://)(master.navada.com:8800)$,1koko2,' file
If the configuration file is written in JSON or some other well know format, you would not use sed
at all, but jq
or some other apropriate tool specifically written for handling files of that format.
sed -i '/kokomaster/!s/master/koko&/' file
First test whether the string kokomaster
exists on the line, and if it doesn't, do the substitution. This is almost a literal translation of "but what we want is to add the koko
word only if koko
not exists before master
word" into sed
.
The &
in the replacement part of the substitution will be replaced by the text matched by the pattern part (i.e. master
).
After reading the comments (see below), you may want to use something more specific that would actually only modify the server name portion of the URI, and not any master
string elsewhere, even if kokomaster
occurred (or not) in the URI path:
sed -i 's,^(discovery.uri=http://)(master),1koko2,' file
You may even want to go as far as matching the exact and full line that you'd want to replace, just to avoid even hypothetical mistakes:
sed -i 's,^(discovery.uri=http://)(master.navada.com:8800)$,1koko2,' file
If the configuration file is written in JSON or some other well know format, you would not use sed
at all, but jq
or some other apropriate tool specifically written for handling files of that format.
edited Jun 6 at 16:50
answered Jun 6 at 12:52
Kusalananda♦Kusalananda
152k18 gold badges298 silver badges478 bronze badges
152k18 gold badges298 silver badges478 bronze badges
1
That wouldn't work ondiscovery.uri=http://master.navada.com:8800/kokomaster
though.
– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. Indiscovery.uri=http://master.navada.com:8800/kokomaster
, there's nokoko
before the firstmaster
. Yet, thatsed
line doesn't add one.
– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the stringkoko
does not already occur beforemaster
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string,koko
already occurs right beforemaster
, so it's not added again.
– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. Themaster
in the server name needs to be replaced even if there may be somekokomaster
in the path. Pedanticly. I guess the OP doesn't care.
– Philippos
Jun 6 at 16:32
|
show 2 more comments
1
That wouldn't work ondiscovery.uri=http://master.navada.com:8800/kokomaster
though.
– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. Indiscovery.uri=http://master.navada.com:8800/kokomaster
, there's nokoko
before the firstmaster
. Yet, thatsed
line doesn't add one.
– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the stringkoko
does not already occur beforemaster
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string,koko
already occurs right beforemaster
, so it's not added again.
– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. Themaster
in the server name needs to be replaced even if there may be somekokomaster
in the path. Pedanticly. I guess the OP doesn't care.
– Philippos
Jun 6 at 16:32
1
1
That wouldn't work on
discovery.uri=http://master.navada.com:8800/kokomaster
though.– Stéphane Chazelas
Jun 6 at 13:54
That wouldn't work on
discovery.uri=http://master.navada.com:8800/kokomaster
though.– Stéphane Chazelas
Jun 6 at 13:54
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
@StéphaneChazelas Correct, as per the explicit specification from the user.
– Kusalananda♦
Jun 6 at 14:51
Not sure I follow. In
discovery.uri=http://master.navada.com:8800/kokomaster
, there's no koko
before the first master
. Yet, that sed
line doesn't add one.– Stéphane Chazelas
Jun 6 at 14:54
Not sure I follow. In
discovery.uri=http://master.navada.com:8800/kokomaster
, there's no koko
before the first master
. Yet, that sed
line doesn't add one.– Stéphane Chazelas
Jun 6 at 14:54
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the string
koko
does not already occur before master
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string, koko
already occurs right before master
, so it's not added again.– Kusalananda♦
Jun 6 at 15:35
@StéphaneChazelas Sorry, that was half a joke, but it is actually what the user specified. If the string
koko
does not already occur before master
, it should not be added again. That's what's requested, and that's what I did, pedantically following the request to the letter. In your string, koko
already occurs right before master
, so it's not added again.– Kusalananda♦
Jun 6 at 15:35
@Kusalananda nope. The
master
in the server name needs to be replaced even if there may be some kokomaster
in the path. Pedanticly. I guess the OP doesn't care.– Philippos
Jun 6 at 16:32
@Kusalananda nope. The
master
in the server name needs to be replaced even if there may be some kokomaster
in the path. Pedanticly. I guess the OP doesn't care.– Philippos
Jun 6 at 16:32
|
show 2 more comments
Use
sed 's/(koko)*master/kokomaster/'
so master
and any number of preceeding koko
s get replaced.
Or better,sed 's/(koko)0,1master/kokomaster/'
to avoid replacingkokokokomaster
withkokomaster
.
– Stéphane Chazelas
Jun 6 at 13:52
add a comment |
Use
sed 's/(koko)*master/kokomaster/'
so master
and any number of preceeding koko
s get replaced.
Or better,sed 's/(koko)0,1master/kokomaster/'
to avoid replacingkokokokomaster
withkokomaster
.
– Stéphane Chazelas
Jun 6 at 13:52
add a comment |
Use
sed 's/(koko)*master/kokomaster/'
so master
and any number of preceeding koko
s get replaced.
Use
sed 's/(koko)*master/kokomaster/'
so master
and any number of preceeding koko
s get replaced.
answered Jun 6 at 12:46
PhilipposPhilippos
6,5961 gold badge19 silver badges51 bronze badges
6,5961 gold badge19 silver badges51 bronze badges
Or better,sed 's/(koko)0,1master/kokomaster/'
to avoid replacingkokokokomaster
withkokomaster
.
– Stéphane Chazelas
Jun 6 at 13:52
add a comment |
Or better,sed 's/(koko)0,1master/kokomaster/'
to avoid replacingkokokokomaster
withkokomaster
.
– Stéphane Chazelas
Jun 6 at 13:52
Or better,
sed 's/(koko)0,1master/kokomaster/'
to avoid replacing kokokokomaster
with kokomaster
.– Stéphane Chazelas
Jun 6 at 13:52
Or better,
sed 's/(koko)0,1master/kokomaster/'
to avoid replacing kokokokomaster
with kokomaster
.– Stéphane Chazelas
Jun 6 at 13:52
add a comment |
If you're open to other tools:
perl -i -pe 's/(?<!koko)master/kokomaster/' file
The (?>!foo)
is a negative lookbehind, so (?<!koko)master
will only match master
when not preceded by koko
.
add a comment |
If you're open to other tools:
perl -i -pe 's/(?<!koko)master/kokomaster/' file
The (?>!foo)
is a negative lookbehind, so (?<!koko)master
will only match master
when not preceded by koko
.
add a comment |
If you're open to other tools:
perl -i -pe 's/(?<!koko)master/kokomaster/' file
The (?>!foo)
is a negative lookbehind, so (?<!koko)master
will only match master
when not preceded by koko
.
If you're open to other tools:
perl -i -pe 's/(?<!koko)master/kokomaster/' file
The (?>!foo)
is a negative lookbehind, so (?<!koko)master
will only match master
when not preceded by koko
.
edited Jun 6 at 14:56
answered Jun 6 at 13:32
terdon♦terdon
137k33 gold badges283 silver badges459 bronze badges
137k33 gold badges283 silver badges459 bronze badges
add a comment |
add a comment |
I have used below awk command to do the same
command
awk '$0 !~/kokomaster/gsub("master","kokomaster",$0)1' filename >file_tmp && mv file_tmp filename
output
discovery.uri=http://kokomaster.navada.com:8800
discovery.uri=http://kokomaster.navada.com:8800
add a comment |
I have used below awk command to do the same
command
awk '$0 !~/kokomaster/gsub("master","kokomaster",$0)1' filename >file_tmp && mv file_tmp filename
output
discovery.uri=http://kokomaster.navada.com:8800
discovery.uri=http://kokomaster.navada.com:8800
add a comment |
I have used below awk command to do the same
command
awk '$0 !~/kokomaster/gsub("master","kokomaster",$0)1' filename >file_tmp && mv file_tmp filename
output
discovery.uri=http://kokomaster.navada.com:8800
discovery.uri=http://kokomaster.navada.com:8800
I have used below awk command to do the same
command
awk '$0 !~/kokomaster/gsub("master","kokomaster",$0)1' filename >file_tmp && mv file_tmp filename
output
discovery.uri=http://kokomaster.navada.com:8800
discovery.uri=http://kokomaster.navada.com:8800
answered Jun 6 at 15:20
Praveen Kumar BSPraveen Kumar BS
2,1302 gold badges3 silver badges11 bronze badges
2,1302 gold badges3 silver badges11 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f523302%2fsed-add-word-before-string-only-if-not-exists%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown