Friday, July 10, 2020

Linux - Splitting & Joining a file

https://www.ibm.com/support/pages/how-use-split-and-cat-commands-split-large-file-smaller-pieces-and-then-restore-pieces-single-file

Splitting:
split -l 1000000 full_file.dat

Output is - xaa, xab, xac

Joining:
cat xab >> xaa
cat xac >> xaa

Note: At the lines where the files are joining, the ending line of part1 and 1st line of part 2 will be concatenated on the same line. We'll have to open the file in vi and just enter a newline in those places.

No comments:

Post a Comment

Followers

Blog Archive