找到并猫合并CSV文件 [英] find and cat to merge csv files

查看:261
本文介绍了找到并猫合并CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在〜/ data的子目录中有数以千计的文件。我希望合并所有这些csv文件与一定的扩展名.x并保存合并的文件到〜/数据/ merged.x



我知道我需要使用查找,猫和>>选项-iname,但我觉得很难做到。



提前致谢

解决方案

  find〜/ data -name* .x| while read file 
do
cat $ file>> 〜/ data / merged.x
完成


I have thousands of files in sub-directories of ~/data. I wish to merge all those csv files with a certain extension say .x and save the merged file to ~/data/merged.x

I know I need to use find,cat and >> with the option -iname, but I'm finding it hard to do.

Thanks in advance

解决方案

find ~/data -name "*.x" | while read file
do
    cat $file >> ~/data/merged.x
done

这篇关于找到并猫合并CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆