Chan Chen Coding...

Split Large File in Linux

Have you ever want to split a large file into several small files? I’ve face this problem few days ago. I need to split a large file (4.4GB log file) into several smaller file where i can read it using normal text editor (vim etc.).

To split large file into several smaller files, you can use split command in Linux. Just follow the steps below and you will be able to split large file into smaller files. 

$split -b 100m /path/to/large/file /path/to/output/file/prefix

  • Done. You just split your large file into several smaller files

* You can change the output file size by changing the –bytes=1m to your preference. You can use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.

To restore the original file, you can use cat command.
To join all the smaller file to restore the original file type:-

$cat prefix* > new/file/name



-----------------------------------------------------
Silence, the way to avoid many problems;
Smile, the way to solve many problems;

posted on 2012-10-22 14:03 Chan Chen 阅读(501) 评论(0)  编辑  收藏 所属分类: Linux


只有注册用户登录后才能发表评论。


网站导航: