Dear all,
I have a list of files and I woulk like to concatenate some of them based on their name.
Basically my files are names like that:
file1_abcd_other_useless_letters_1_C1.txt
file1_abcd_other_useless_letters_1_C2.txt
file1_xywz_other_useless_letters_1_C1.txt
file1_xywz_other_useless_letters_1_C2.txt
file2_abcd_other_useless_letters_2_C1.txt
file2_abcd_other_useless_letters_2_C2.txt
file2_xywz_other_useless_letters_2_C1.txt
file2_xywz_other_useless_letters_2_C2.txt
Basically, I woul like the files with the same color to be concatenate.
Output:
abcd_other_useless_letters_C1.txt (merge of file1_abcd_other_useless_letters_1_C1.txt & file2_abcd_other_useless_letters_2_C1.txt )
abcd_other_useless_letters_C2.txt
xywz_other_useless_letters_C1.txt
xywz_other_useless_letters_C2.txt
That means (suppose
_
as separator) ,for the merged files
1)first field
file
should be different
2) second field
abcd
should be the same
3) fields
other_useless_letters
should not be considered at all
4) second to last field
1
should be different
5) last field
C1
should be the same
well, I think that the color code of file is still the better explanation
Hope someone can help me.
Best
Giuliano