I have a file with about 800,000 lines, is it possible to create a new file for every 50,000 lines? if so how?
e.g. data is exported every 50,000 lines to a separate file on BBedit. So I should end up with 16 more files containing 50,000 lines each.
Use the shell
split -l 50000 input.txt outputfilename
Thank you for this, is this an action in KM? I am not sure how to execute it.
You can run it from Terminal. Just start Terminal, and type in (or paste in) the above command, with your file names.
If the paths to your input or output file contain spaces, then enclose them in quotes.
split: outputfilenameaa: Permission denied
Show the exact text you typed in (you can use the mouse to select it, then do Cmd+C).
I sent you a private message because of the location of the file is on the there…
I don’t think the location is an issue, security-wise, but that’s cool.
Here’s an edited version:
split -l 50000 /Users/whatever/wherever/Data/"ALL PURCHASED NUMBERS.txt" outputfilename
Try something like this:
split -l 50000 "/Users/whatever/wherever/Data/ALL PURCHASED NUMBERS.txt" "/Users/whatever/wherever/Data/SPLIT PURCHASED NUMBERS"
See how that works.
How would I get it as a .txt?
I’m not sure. Perhaps someone else can chime in.
Rename the files afterwards.
In Yosemite, the Finder finally allows
Batch Rename of files by control-clicking on a set of files.
However, the options are fairly limited and their is no preview at all. The end of the TidBITS article and the comments list various third party applications, but I've been using this macro for quite a while and it works well.
It prompts for the search and replace formats, and then asks for each file whether you wish to rename to a specific new name. You can click "Rename All" once you're sa…