escape certain characters in a shell variable [duplicate]
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
This question already has an answer here:
How to ensure that string interpolated into `sed` substitution escapes all metachars
1 answer
What characters do I need to escape when using sed in a sh script?
3 answers
I have a shell variable which will be used within the replacement string of a sed regex.
Therefore, all characters &
, /
and need to be escaped by a preceeding
.
I managed to do it for &
and /
by
newvar=`echo "$oldvar" | sed -e 's|&|\&|g' -e 's|/|\/|g'`
1st question: Is this fine (piping content to sed via echo etc.)?
2nd question: Somehow I cannot get it to work for the backslash. Can you show me how to do it?
shell sed
marked as duplicate by Jeff Schaller♦, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 13 at 13:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to ensure that string interpolated into `sed` substitution escapes all metachars
1 answer
What characters do I need to escape when using sed in a sh script?
3 answers
I have a shell variable which will be used within the replacement string of a sed regex.
Therefore, all characters &
, /
and need to be escaped by a preceeding
.
I managed to do it for &
and /
by
newvar=`echo "$oldvar" | sed -e 's|&|\&|g' -e 's|/|\/|g'`
1st question: Is this fine (piping content to sed via echo etc.)?
2nd question: Somehow I cannot get it to work for the backslash. Can you show me how to do it?
shell sed
marked as duplicate by Jeff Schaller♦, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 13 at 13:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to ensure that string interpolated into `sed` substitution escapes all metachars
1 answer
What characters do I need to escape when using sed in a sh script?
3 answers
I have a shell variable which will be used within the replacement string of a sed regex.
Therefore, all characters &
, /
and need to be escaped by a preceeding
.
I managed to do it for &
and /
by
newvar=`echo "$oldvar" | sed -e 's|&|\&|g' -e 's|/|\/|g'`
1st question: Is this fine (piping content to sed via echo etc.)?
2nd question: Somehow I cannot get it to work for the backslash. Can you show me how to do it?
shell sed
This question already has an answer here:
How to ensure that string interpolated into `sed` substitution escapes all metachars
1 answer
What characters do I need to escape when using sed in a sh script?
3 answers
I have a shell variable which will be used within the replacement string of a sed regex.
Therefore, all characters &
, /
and need to be escaped by a preceeding
.
I managed to do it for &
and /
by
newvar=`echo "$oldvar" | sed -e 's|&|\&|g' -e 's|/|\/|g'`
1st question: Is this fine (piping content to sed via echo etc.)?
2nd question: Somehow I cannot get it to work for the backslash. Can you show me how to do it?
This question already has an answer here:
How to ensure that string interpolated into `sed` substitution escapes all metachars
1 answer
What characters do I need to escape when using sed in a sh script?
3 answers
shell sed
shell sed
asked Mar 13 at 13:43
azimutazimut
1032
1032
marked as duplicate by Jeff Schaller♦, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 13 at 13:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Jeff Schaller♦, Stéphane Chazelas
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 13 at 13:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes