O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.7. Using split

Split allows you to divide large text files into smaller files. It’s surprising how quickly files can grow and, when you need to transfer files, it’s sometimes easier to split them up first. When using vi or other tools such as sort, you can have problems if the file is too big for the working buffer so sometimes you are not given a choice; you have to create smaller chunks out of the file.

Here is the general format of the split command:

split -output-file-size input-filename output-filename 

where output-file-size is the number of lines you want the file to be split by. When split looks at the file output-file-size option specified it will try to divide the files into 1 000 lines each. If we had a file containing 2 800 lines, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required