I got a text file file.txt(12 MBs) containing:
something1
something2
something3
something4
(...)
Is there any way to split
I agree with @CS Pei, however this didn't work for me:
split -b=1M -d file.txt file
...as the = after -b threw it off. Instead, I simply deleted it and left no space between it and the variable, and used lowercase "m":
split -b1m -d file.txt file
And to append ".txt", we use what @schoon said:
split -b=1m -d file.txt file --additional-suffix=.txt
I had a 188.5MB txt file and I used this command [but with -b5m for 5.2MB files], and it returned 35 split files all of which were txt files and 5.2MB except the last which was 5.0MB. Now, since I wanted my lines to stay whole, I wanted to split the main file every 1 million lines, but the split command didn't allow me to even do -100000 let alone "-1000000, so large numbers of lines to split will not work.