I need to merge several files, removing redundant lines among files, while keeping redundant lines within files. A schematic representation of my files is the following:
File1.txt
1
2
3
3
4
5
6
File2.txt
6
7
8
8
9
File3.txt
9
10
10
11
The desired output would be:
1
2
3
3
4
5
6
7
8
8
9
10
10
11
I would prefer to get a solution either in awk, or in bash or in R language. I searched the web for solutions and, though there were plenty of them* (please find some examples below), there were all removing duplicated lines regardless of the fact that they were located within or outside files.
Thanks in advance. Arturo
- Examples of previous solutions removing redundant lines both within and outside files: https://unix.stackexchange.com/questions/50103/merge-two-lists-while-removing-duplicates https://unix.stackexchange.com/questions/457320/combine-text-files-and-delete-duplicate-lines https://unix.stackexchange.com/questions/350520/awk-combine-two-big-files-and-remove-duplicated-lines https://unix.stackexchange.com/questions/257467/merging-2-files-and-keeping-the-one-duplicate