I have about 450 csv files in a folder with names in the format (sample names below):
1_a.csv
1_b.csv
1_c.csv
...
1_h.csv
2_a.csv
2_b.csv
...
2_h.csv
...
42_a.csv
...
42_h.csv
I wish to combine all files of the type "1_xxx.csv" into "1.csv", all files of the format "2_xxx.csv" into "2.csv" and so on.
I tried using cat but I am only able to merge one set of files at a time. Is there a way to run the command in loop in linux? Any Python3 based solutions are also welcome.