2 added 602 characters in body
source | link

In your linked question there is already good awk answer, just modify it a little bit by using printf instead of print to insert the content without newline:

awk '/First/ { printf $0; getline < "File1.txt" }1' infile.txt

Result:

Some Text here
FirstThis is text to be inserted into the File.
Second
Some Text here

You may want to add space or other delimeter after "First" with printf $0 " "; ...


If inserted file has many lines then:

awk '/First/{printf $0; while(getline line<"File1.txt"){print line};next}1' infile.txt

Result:

Some Text here
First[
    {
        "foo": "bar", 
        "baz": "biff",
        "data": [
            {
                "a": 1945619, 
                "b": [
                    {
                        "c": 512665, 
                        "d": "futz"
                    }
                ]
            }
        ]
    }
]
Second
Some Text here

In your linked question there is already good awk answer, just modify it a little bit by using printf instead of print to insert the content without newline:

awk '/First/ { printf $0; getline < "File1.txt" }1' infile.txt

Result:

Some Text here
FirstThis is text to be inserted into the File.
Second
Some Text here

You may want to add space or other delimeter after "First" with printf $0 " "; ...

In your linked question there is already good awk answer, just modify it a little bit by using printf instead of print to insert the content without newline:

awk '/First/ { printf $0; getline < "File1.txt" }1' infile.txt

Result:

Some Text here
FirstThis is text to be inserted into the File.
Second
Some Text here

You may want to add space or other delimeter after "First" with printf $0 " "; ...


If inserted file has many lines then:

awk '/First/{printf $0; while(getline line<"File1.txt"){print line};next}1' infile.txt

Result:

Some Text here
First[
    {
        "foo": "bar", 
        "baz": "biff",
        "data": [
            {
                "a": 1945619, 
                "b": [
                    {
                        "c": 512665, 
                        "d": "futz"
                    }
                ]
            }
        ]
    }
]
Second
Some Text here
1
source | link

In your linked question there is already good awk answer, just modify it a little bit by using printf instead of print to insert the content without newline:

awk '/First/ { printf $0; getline < "File1.txt" }1' infile.txt

Result:

Some Text here
FirstThis is text to be inserted into the File.
Second
Some Text here

You may want to add space or other delimeter after "First" with printf $0 " "; ...