I have been working on data recently. Because the file is too large, it is difficult to execute sql, so I divided the file into several small files and learned a new command. Share as follows :
The Linux csplit command is used to split files.
grammar
csplit [-kqsz][-b<output format>][-f<output prefix string>]
[-n<output filename digits>][--help][--version][file][template style...]
Parameters :
- -k or --keep-files keep files, even if an error occurs or execution is interrupted, the files that have been output and saved cannot be deleted.
- -q or -s or --quiet or --silent do not display the command execution process.
- -z or --elide-empty-files Delete files of length 0 Byte.
- --help Online help.
- --version display version information
例 :csplit -k -f TEST_2137 -b "%04d.sql" TEST_2137.bak 22600 {10}
Separate the file TEST_2137.bak every 22600 lines, and then generate up to 10 files, the file name prefix TEST_2137 suffix is 4 digits and then .sql