sed help please

Forum Forums General Software sed help please

Tagged: 

This topic contains 3 replies, has 2 voices, and was last updated by to-the-moon Jan 17-3:31 pm.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16612
    Member
    Avatar
    to-the-moon

    hey i need a sed command to take all text from file1 line1 and place the text at the end of file2 line1 – targets are bothe from file to file

    EXAMPLE-FILE-1-LINE-1
    1000

    EXAMPLE-FILE-2 BEFORE PATCH LINE 1
    127.0.0.1:

    EXAMPLE-FILE-2 AFTRER PATCH LINE 1
    127.0.0.1:1000

    please help

    #16613
    Member
    Avatar
    to-the-moon

    or any kinda command echo what ever

    #16618
    Forum Admin
    BitJam
    BitJam
    line1=$(head -n1 f1)
    sed -i "\$s/$/$line1/" f2

    This assumes the last line of f1 does not contain special characters like “/”. If it does or might then those need to “escaped” between the two lines above.

    Context is worth 80 IQ points -- Alan Kay

    #16622
    Member
    Avatar
    to-the-moon

    Thank you so much 🙂 your awesome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.