I'm trying to make a script that gets number values from a file (multiple lines) and adds said values to another file in order of appearance (if that makes sense). I'm pretty green when it comes to this. There's probably some way to use sed, or maybe even omit the file creation and simply make sed take the values from the results of grep?
Dunno if I can explain it better.
Basically I put the results of grep in a file for example the results would be: 101 102 104 108 111 etc now I want to add those results each single one to a specific line in another file for example:
external=200100
external=200100
external=200100
etc
the end result I want is:
external=200100101
external=200100102
external=200100104
Sorry if I'm not being clear enough about this, this is my first time dabbling in this and also I don't really know the proper terminology for everything.
Wanted to clarify that there's other stuff in between the "external=200100" values. So just copying 1 to 1 won't work. It needs to find every "external=200100" value and paste the results of grep at the end of each "external=200100" in proper order.
Clearer example maybe:
1 Results of grep:
100
104
2 Insides of the file I want to edit:
[100]
secret=blah
type=blah
dial=blah
external=200100
[104]
secret=blah
type=blah
dial=blah
external=200100
etc
3 End result
[100]
secret=blah
type=blah
dial=blah
external=200100100
[104]
secret=blah
type=blah
dial=blah
external=200100104
etc
Hope that's clear enough.