Pages

mercredi 29 mai 2013

insert a text file after a line of another file


to insert file1.txt after the second line of file2.txt, any of the following commands will do:
  • $ sed -i '2r file1.txt' file2.txt

  • $ awk '{print} NR==2 {while (getline < "file1.txt") print}' file2.txt

Aucun commentaire:

Enregistrer un commentaire