awk -v file2insert=file2 -v insertafter=3 '
Launch awk with 2 variables initialised from the shell:
file2insert will be an awk variable containing the pathname of the file to merge
insertafter will be an awk variable containing the line number after which the merge must be done {print}
print to the output file each line of the input file NR==insertafter
If we have just read (and printed) the number of desired lines {while((getline<file2insert)>0)print}
Loop reading each line of the desired file and printing them ' /path/to/file1
name of input file
Anyway: man awk
Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.