Merging Files in a Directory

Discussion in 'Programming/Scripts' started by Robynlep, Mar 7, 2023.

  1. Robynlep

    Robynlep New Member

    I have a directory full of .txt files. I need to copy these files into a new directory, but I want to merge the files that have a duplicate line inside of the text. For example, these files would be merged into one file when copied to the new directory because the first line of text is the same.

    file1.txt
    My favorite food: ice cream
    I love ice cream because it cools me off on a hot day.

    file2.txt
    My favorite food: ice cream
    I really like ice cream because it is sweet and creamy.

    Any help on how to write a command for this is appreciated.
     
    Last edited: Mar 9, 2023

Share This Page