How to append to the end of each line?How to search, replace and append a pattern to the end of each lineHow...

BIP-23 criticism: Is bitcoin PoW actually sha256+merkleGeneration? Or have I misunderstood coinbase/append?

How deep is the Underdark? What is its max and median depth?

Remove side menu(right side) from finder

Does the Bracer of Flying Daggers really let a thief make 4 attacks per round?

How does the Gameboy's memory bank switching work?

Manager is asking me to eat breakfast from now on

Does unblocking power bar outlets through short extension cords increase fire risk?

Found old paper shares of Motorola Inc that has since been broken up

Father as an heir

Are there foods that astronauts are explicitly never allowed to eat?

How much did all the space agencies spent on rockets launching and space exploration? What are the benefits for me and you?

Inside Out and Back to Front

What is the intuition for higher homotopy groups not vanishing?

How to tell readers that I know my story is factually incorrect?

When we are talking about black hole evaporation - what exactly happens?

Inscriptio Labyrinthica

Weight functions in graph algorithms

What's a German word for »Sandbagger«?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

Why didn't Balak request Bilam to bless his own people?

You have no, but can try for yes

What does Windows' "Tuning up Application Start" do?

Time war story - soldier name lengthens as he travels further from the battle front

Can a crisscrossed metallic skeleton resist earthquakes for buildings?



How to append to the end of each line?


How to search, replace and append a pattern to the end of each lineHow to delete the first few lines of data and a specific matching numeric number until the very end of datased backreference: get each line and append it to end of lineHow to append some string combined with the pattern at the end of line with the patternAppending word at the end of line with sedsed script to remove all lines with a pattern and append lines at the endAppend string after each line except header and footer lineREGEX search & replace with sed or other commandSed Replace a pattern between a pattern and the end of fileHow to append line with strings at the end of variable?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I have this file, ipaddresses.txt



152.48.64.13
146.112.164.43
236.157.219.229
188.201.225.93
193.140.79.73
...


And this file, cidr.txt



20
21
8
20
21
...


And I want the output file to be like this:



152.48.64.13/20
146.112.164.43/21
236.157.219.229/8
188.201.225.93/20
193.140.79.73/21
...


How to achieve this using sed, or else?










share|improve this question




















  • 2





    Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

    – steeldriver
    1 hour ago











  • Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

    – Annahri
    1 hour ago






  • 1





    @Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

    – Nasir Riley
    51 mins ago













  • @NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

    – Annahri
    33 mins ago













  • @Annahri do your files have Windows style (CRLF) line endings by any chance?

    – steeldriver
    32 mins ago


















0















I have this file, ipaddresses.txt



152.48.64.13
146.112.164.43
236.157.219.229
188.201.225.93
193.140.79.73
...


And this file, cidr.txt



20
21
8
20
21
...


And I want the output file to be like this:



152.48.64.13/20
146.112.164.43/21
236.157.219.229/8
188.201.225.93/20
193.140.79.73/21
...


How to achieve this using sed, or else?










share|improve this question




















  • 2





    Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

    – steeldriver
    1 hour ago











  • Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

    – Annahri
    1 hour ago






  • 1





    @Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

    – Nasir Riley
    51 mins ago













  • @NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

    – Annahri
    33 mins ago













  • @Annahri do your files have Windows style (CRLF) line endings by any chance?

    – steeldriver
    32 mins ago














0












0








0








I have this file, ipaddresses.txt



152.48.64.13
146.112.164.43
236.157.219.229
188.201.225.93
193.140.79.73
...


And this file, cidr.txt



20
21
8
20
21
...


And I want the output file to be like this:



152.48.64.13/20
146.112.164.43/21
236.157.219.229/8
188.201.225.93/20
193.140.79.73/21
...


How to achieve this using sed, or else?










share|improve this question
















I have this file, ipaddresses.txt



152.48.64.13
146.112.164.43
236.157.219.229
188.201.225.93
193.140.79.73
...


And this file, cidr.txt



20
21
8
20
21
...


And I want the output file to be like this:



152.48.64.13/20
146.112.164.43/21
236.157.219.229/8
188.201.225.93/20
193.140.79.73/21
...


How to achieve this using sed, or else?







text-processing sed






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 38 mins ago







Annahri

















asked 1 hour ago









AnnahriAnnahri

47 bronze badges




47 bronze badges








  • 2





    Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

    – steeldriver
    1 hour ago











  • Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

    – Annahri
    1 hour ago






  • 1





    @Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

    – Nasir Riley
    51 mins ago













  • @NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

    – Annahri
    33 mins ago













  • @Annahri do your files have Windows style (CRLF) line endings by any chance?

    – steeldriver
    32 mins ago














  • 2





    Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

    – steeldriver
    1 hour ago











  • Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

    – Annahri
    1 hour ago






  • 1





    @Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

    – Nasir Riley
    51 mins ago













  • @NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

    – Annahri
    33 mins ago













  • @Annahri do your files have Windows style (CRLF) line endings by any chance?

    – steeldriver
    32 mins ago








2




2





Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

– steeldriver
1 hour ago





Why sed, specifically? have you considered alternatives - such as paste -d/ ipaddresses.txt cidr.txt ?

– steeldriver
1 hour ago













Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

– Annahri
1 hour ago





Because I only know sed to do this kind of task, I will edit my thread. By the way, I tried using paste, it doesn't append to the last line, but it append a new line each.

– Annahri
1 hour ago




1




1





@Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

– Nasir Riley
51 mins ago







@Annahri The paste command by steeldriver works. Do you not have GNU paste or is there something with your environment such as an alias?

– Nasir Riley
51 mins ago















@NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

– Annahri
33 mins ago







@NasirRiley I'm using bash on Ubuntu on Windows 10 (what is the correct term for this?) I did paste -d/ ipaddresses.txt cidr.txt > out.txt. When I try to do it without outputting a file, It prints a different behaviour. It adds in the beginning of each line but It does correctly for the very last line. Hmm

– Annahri
33 mins ago















@Annahri do your files have Windows style (CRLF) line endings by any chance?

– steeldriver
32 mins ago





@Annahri do your files have Windows style (CRLF) line endings by any chance?

– steeldriver
32 mins ago










0






active

oldest

votes














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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f531358%2fhow-to-append-to-the-end-of-each-line%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f531358%2fhow-to-append-to-the-end-of-each-line%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...