What does ,^@ means in a sed expression

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I came across this code sed ',^@, s/ABC/XYZ/' filename
What does ,^@, means here. I thought comma , operator defines the line range on which substitute expression will operate.







share|improve this question






















  • , means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
    – Sundeep
    Apr 11 at 13:26










  • see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
    – Sundeep
    Apr 11 at 13:27










  • Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
    – CppLearner
    Apr 11 at 13:46










  • see Find the line [...] using custom regex delimiter
    – don_crissti
    Apr 11 at 14:29











  • @CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
    – Sundeep
    Apr 11 at 14:30















up vote
3
down vote

favorite












I came across this code sed ',^@, s/ABC/XYZ/' filename
What does ,^@, means here. I thought comma , operator defines the line range on which substitute expression will operate.







share|improve this question






















  • , means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
    – Sundeep
    Apr 11 at 13:26










  • see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
    – Sundeep
    Apr 11 at 13:27










  • Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
    – CppLearner
    Apr 11 at 13:46










  • see Find the line [...] using custom regex delimiter
    – don_crissti
    Apr 11 at 14:29











  • @CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
    – Sundeep
    Apr 11 at 14:30













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I came across this code sed ',^@, s/ABC/XYZ/' filename
What does ,^@, means here. I thought comma , operator defines the line range on which substitute expression will operate.







share|improve this question














I came across this code sed ',^@, s/ABC/XYZ/' filename
What does ,^@, means here. I thought comma , operator defines the line range on which substitute expression will operate.









share|improve this question













share|improve this question




share|improve this question








edited Apr 11 at 14:30









don_crissti

46.4k15123152




46.4k15123152










asked Apr 11 at 13:21









CppLearner

3481212




3481212











  • , means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
    – Sundeep
    Apr 11 at 13:26










  • see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
    – Sundeep
    Apr 11 at 13:27










  • Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
    – CppLearner
    Apr 11 at 13:46










  • see Find the line [...] using custom regex delimiter
    – don_crissti
    Apr 11 at 14:29











  • @CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
    – Sundeep
    Apr 11 at 14:30

















  • , means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
    – Sundeep
    Apr 11 at 13:26










  • see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
    – Sundeep
    Apr 11 at 13:27










  • Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
    – CppLearner
    Apr 11 at 13:46










  • see Find the line [...] using custom regex delimiter
    – don_crissti
    Apr 11 at 14:29











  • @CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
    – Sundeep
    Apr 11 at 14:30
















, means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
– Sundeep
Apr 11 at 13:26




, means , is regex delimiter instead of usual /... ^@ to match @ at beginning of line... , to end the match... s/ABC/XYZ/ to perform substitutions only on lines matching @ at beginning of line...
– Sundeep
Apr 11 at 13:26












see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
– Sundeep
Apr 11 at 13:27




see also: stackoverflow.com/questions/5864146/use-slashes-in-sed-replace
– Sundeep
Apr 11 at 13:27












Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
– CppLearner
Apr 11 at 13:46




Thanks Sundeep, sorry but I am still not clear. I understood ^@ denotes lines starting with @. Are you saying , means alternate regex delimeter , then shouldn't it be just ,@, or ,@,. Thanks
– CppLearner
Apr 11 at 13:46












see Find the line [...] using custom regex delimiter
– don_crissti
Apr 11 at 14:29





see Find the line [...] using custom regex delimiter
– don_crissti
Apr 11 at 14:29













@CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
– Sundeep
Apr 11 at 14:30





@CppLearner for substitute commands, s,foo,baz, will work.. but for address matching, you need extra at start...
– Sundeep
Apr 11 at 14:30











1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










According to the man page, In a context address, the construction "cBREc", where c is any character other than backslash or newline, shall be identical to "/BRE/". So your script is identical to



sed '/^@/ s/ABC/XYZ/' filename


which means the replacement is only to be done in lines starting with @






share|improve this answer






















  • Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
    – CppLearner
    Apr 11 at 15:25










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437016%2fwhat-does-means-in-a-sed-expression%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
4
down vote



accepted










According to the man page, In a context address, the construction "cBREc", where c is any character other than backslash or newline, shall be identical to "/BRE/". So your script is identical to



sed '/^@/ s/ABC/XYZ/' filename


which means the replacement is only to be done in lines starting with @






share|improve this answer






















  • Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
    – CppLearner
    Apr 11 at 15:25














up vote
4
down vote



accepted










According to the man page, In a context address, the construction "cBREc", where c is any character other than backslash or newline, shall be identical to "/BRE/". So your script is identical to



sed '/^@/ s/ABC/XYZ/' filename


which means the replacement is only to be done in lines starting with @






share|improve this answer






















  • Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
    – CppLearner
    Apr 11 at 15:25












up vote
4
down vote



accepted







up vote
4
down vote



accepted






According to the man page, In a context address, the construction "cBREc", where c is any character other than backslash or newline, shall be identical to "/BRE/". So your script is identical to



sed '/^@/ s/ABC/XYZ/' filename


which means the replacement is only to be done in lines starting with @






share|improve this answer














According to the man page, In a context address, the construction "cBREc", where c is any character other than backslash or newline, shall be identical to "/BRE/". So your script is identical to



sed '/^@/ s/ABC/XYZ/' filename


which means the replacement is only to be done in lines starting with @







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 11 at 14:23









Kusalananda

102k13199316




102k13199316










answered Apr 11 at 14:20









Philippos

5,90211545




5,90211545











  • Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
    – CppLearner
    Apr 11 at 15:25
















  • Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
    – CppLearner
    Apr 11 at 15:25















Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
– CppLearner
Apr 11 at 15:25




Perfect Philippos. This is what I was looking for thanks a lot for your help and explanation. Upvoting and accepting this as answer. Thank you.
– CppLearner
Apr 11 at 15:25












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437016%2fwhat-does-means-in-a-sed-expression%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?