Merge multiple csv files with same name in 10 different subdirectory

后端 未结 2 436
清酒与你
清酒与你 2020-12-22 06:18

i have 10 different subdirectories with same file names in each directory ( 20 files per directory ) and column 0 is the index column in each file.

e.g



        
2条回答
  •  春和景丽
    2020-12-22 06:33

    This can be achieved in much simple way in shell as:

    find . -name "*.csv" | xargs cat > mergedCSV
    

    (Note: Don't use .csv in extension as it will cause inconsistency with find. After this command is finished, file can be renamed as .csv

提交回复
热议问题