I have a series of txt files, each with numerous entries. I usually merge all the txt files into one output file using cat, however it becomes a little bit messy because I cannot be sure from which original txt file it came from.
I was wondering if there is a way, using the command line, to first merge all the txt files in alphabetical order and at the same time add the suffix to the original entry to note the file it came from.
For example, let's say I have 2 txt files, each with three entries:
File_One:
Alpha
Bravo
Charlie
File_Two:
Alpha
Bravo
Delta
What I would like to do is this:
- Merge the two lists in one output txt file sorted in alphabetical order;
Add the suffix to show from which list it comes from:
Alpha_File_One Alpha_File_Two Bravo_File_One Bravo_File_Two Charlie_File_One Delta_File_Two
Is this possible?