Skip to main content
clarify what is happening
Source Link

This is fairly simple with AWK:

File1 into File2 before pattern = "Pointer"

First load the contents of File1 into a variable

f1="$(<File1)"

then do the insertion

awk -vf1="$f1" '/Pointer/{print f1;print;next}1' file2

(ifOr, if you want to insert File1 after "Pointer")

awk -vf1="$f1" '/Pointer/{print;print f1;next}1' file2

This is fairly simple with AWK:

File1 into File2 before pattern = "Pointer"

f1="$(<File1)"
awk -vf1="$f1" '/Pointer/{print f1;print;next}1' file2

(if you want to insert File1 after "Pointer")

awk -vf1="$f1" '/Pointer/{print;print f1;next}1' file2

This is fairly simple with AWK:

File1 into File2 before pattern = "Pointer"

First load the contents of File1 into a variable

f1="$(<File1)"

then do the insertion

awk -vf1="$f1" '/Pointer/{print f1;print;next}1' file2

(Or, if you want to insert File1 after "Pointer")

awk -vf1="$f1" '/Pointer/{print;print f1;next}1' file2
Source Link

This is fairly simple with AWK:

File1 into File2 before pattern = "Pointer"

f1="$(<File1)"
awk -vf1="$f1" '/Pointer/{print f1;print;next}1' file2

(if you want to insert File1 after "Pointer")

awk -vf1="$f1" '/Pointer/{print;print f1;next}1' file2