Does anyone know if there is a way to insert text in a file before the current text that is in there(not append).
So for example if I have file1 and want to get the first 3 lines of that file and insert those 3 lines into the beginning of file2. I have sed 3q file1 to grab the 3 lines from file1 but can't figure out how to get that output into the first 3 lines of file2. I didn't want to append to the file because the three lines from file1 need to go before the existing lines in file2. Looked at the head command but not exactly sure if I can incorporate that. Thanks.
So for example if I have file1 and want to get the first 3 lines of that file and insert those 3 lines into the beginning of file2. I have sed 3q file1 to grab the 3 lines from file1 but can't figure out how to get that output into the first 3 lines of file2. I didn't want to append to the file because the three lines from file1 need to go before the existing lines in file2. Looked at the head command but not exactly sure if I can incorporate that. Thanks.