Adding words (tags) to a file [duplicate]











up vote
-1
down vote

favorite













This question already has an answer here:




  • Insert line after first match using sed

    6 answers




I want to add the words "Getting started" to two markdown files (so the extension is .md). They are named:

* installing-disqus.md

* installing-google-analytics.md



I would like to populate that word right after the line "Tags: " so the outcome would be "Tags: Getting started"



In Bash, what command would I write. I am thinking it would look something like this:



echo "Getting started" >> *installing* *Tags:*









share|improve this question















marked as duplicate by shellter bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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();
}
);
});
});
Nov 10 at 23:09


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.















  • Hint: try using sed.
    – user202729
    Nov 10 at 16:22










  • How is this related to keywords?
    – user202729
    Nov 10 at 16:22















up vote
-1
down vote

favorite













This question already has an answer here:




  • Insert line after first match using sed

    6 answers




I want to add the words "Getting started" to two markdown files (so the extension is .md). They are named:

* installing-disqus.md

* installing-google-analytics.md



I would like to populate that word right after the line "Tags: " so the outcome would be "Tags: Getting started"



In Bash, what command would I write. I am thinking it would look something like this:



echo "Getting started" >> *installing* *Tags:*









share|improve this question















marked as duplicate by shellter bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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();
}
);
});
});
Nov 10 at 23:09


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.















  • Hint: try using sed.
    – user202729
    Nov 10 at 16:22










  • How is this related to keywords?
    – user202729
    Nov 10 at 16:22













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite












This question already has an answer here:




  • Insert line after first match using sed

    6 answers




I want to add the words "Getting started" to two markdown files (so the extension is .md). They are named:

* installing-disqus.md

* installing-google-analytics.md



I would like to populate that word right after the line "Tags: " so the outcome would be "Tags: Getting started"



In Bash, what command would I write. I am thinking it would look something like this:



echo "Getting started" >> *installing* *Tags:*









share|improve this question
















This question already has an answer here:




  • Insert line after first match using sed

    6 answers




I want to add the words "Getting started" to two markdown files (so the extension is .md). They are named:

* installing-disqus.md

* installing-google-analytics.md



I would like to populate that word right after the line "Tags: " so the outcome would be "Tags: Getting started"



In Bash, what command would I write. I am thinking it would look something like this:



echo "Getting started" >> *installing* *Tags:*




This question already has an answer here:




  • Insert line after first match using sed

    6 answers








bash echo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 16:23

























asked Nov 10 at 16:18









jimmytt

19829




19829




marked as duplicate by shellter bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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();
}
);
});
});
Nov 10 at 23:09


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 shellter bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

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();
}
);
});
});
Nov 10 at 23:09


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.














  • Hint: try using sed.
    – user202729
    Nov 10 at 16:22










  • How is this related to keywords?
    – user202729
    Nov 10 at 16:22


















  • Hint: try using sed.
    – user202729
    Nov 10 at 16:22










  • How is this related to keywords?
    – user202729
    Nov 10 at 16:22
















Hint: try using sed.
– user202729
Nov 10 at 16:22




Hint: try using sed.
– user202729
Nov 10 at 16:22












How is this related to keywords?
– user202729
Nov 10 at 16:22




How is this related to keywords?
– user202729
Nov 10 at 16:22












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You could use sed to do a find and replace. Since you want the words added after Tags: (assumming there is only one such line) you could run:



sed -i “s/Tags:/Tags:<your text here>/g” <filename>



-i means that it will do the changes in the file
s/ means it will do a substitution
/
/g do this substitution in the whole file






share|improve this answer








New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
    – jimmytt
    Nov 10 at 16:32












  • You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:35










  • I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
    – jimmytt
    Nov 10 at 16:39












  • Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
    – jimmytt
    Nov 10 at 16:40










  • Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:45


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You could use sed to do a find and replace. Since you want the words added after Tags: (assumming there is only one such line) you could run:



sed -i “s/Tags:/Tags:<your text here>/g” <filename>



-i means that it will do the changes in the file
s/ means it will do a substitution
/
/g do this substitution in the whole file






share|improve this answer








New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
    – jimmytt
    Nov 10 at 16:32












  • You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:35










  • I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
    – jimmytt
    Nov 10 at 16:39












  • Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
    – jimmytt
    Nov 10 at 16:40










  • Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:45















up vote
0
down vote













You could use sed to do a find and replace. Since you want the words added after Tags: (assumming there is only one such line) you could run:



sed -i “s/Tags:/Tags:<your text here>/g” <filename>



-i means that it will do the changes in the file
s/ means it will do a substitution
/
/g do this substitution in the whole file






share|improve this answer








New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
    – jimmytt
    Nov 10 at 16:32












  • You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:35










  • I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
    – jimmytt
    Nov 10 at 16:39












  • Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
    – jimmytt
    Nov 10 at 16:40










  • Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:45













up vote
0
down vote










up vote
0
down vote









You could use sed to do a find and replace. Since you want the words added after Tags: (assumming there is only one such line) you could run:



sed -i “s/Tags:/Tags:<your text here>/g” <filename>



-i means that it will do the changes in the file
s/ means it will do a substitution
/
/g do this substitution in the whole file






share|improve this answer








New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









You could use sed to do a find and replace. Since you want the words added after Tags: (assumming there is only one such line) you could run:



sed -i “s/Tags:/Tags:<your text here>/g” <filename>



-i means that it will do the changes in the file
s/ means it will do a substitution
/
/g do this substitution in the whole file







share|improve this answer








New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this answer



share|improve this answer






New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered Nov 10 at 16:28









Andrei Dumitrescu-Tudor

874




874




New contributor




Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Andrei Dumitrescu-Tudor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
    – jimmytt
    Nov 10 at 16:32












  • You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:35










  • I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
    – jimmytt
    Nov 10 at 16:39












  • Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
    – jimmytt
    Nov 10 at 16:40










  • Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:45


















  • This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
    – jimmytt
    Nov 10 at 16:32












  • You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:35










  • I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
    – jimmytt
    Nov 10 at 16:39












  • Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
    – jimmytt
    Nov 10 at 16:40










  • Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
    – Andrei Dumitrescu-Tudor
    Nov 10 at 16:45
















This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
– jimmytt
Nov 10 at 16:32






This is headed in the right direction. How would I do it with two files Andrei? Both files start with "installing" and and in ".md" - "installing-disqus.md" and "installing-google-analytics.md"
– jimmytt
Nov 10 at 16:32














You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
– Andrei Dumitrescu-Tudor
Nov 10 at 16:35




You can use the wildcard operator “*” but better yet read this answer stackoverflow.com/a/10446276/10632970 .
– Andrei Dumitrescu-Tudor
Nov 10 at 16:35












I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
– jimmytt
Nov 10 at 16:39






I am not sure what to do about the error message I got. Here is my attempt: sed -i "s/Tags:/Tags: Getting started/g" installing
– jimmytt
Nov 10 at 16:39














Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
– jimmytt
Nov 10 at 16:40




Here is my error: sed: 1: "installing-disqus.md": command i expects followed by text
– jimmytt
Nov 10 at 16:40












Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
– Andrei Dumitrescu-Tudor
Nov 10 at 16:45




Can you tell me what environment your are using? I tried this command on Ubuntu 18.10 and it worked.
– Andrei Dumitrescu-Tudor
Nov 10 at 16:45



Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma