Hacker News new | comments | ask | show | jobs | submit login
Exploring permutations and a mystery with BSD and GNU split filenames (lorainekv.com)
19 points by kawera on Jan 23, 2018 | hide | past | web | favorite | 3 comments



"In fact, I vaguely remember splitting large files into smaller ones with numerical filenames, which I prefer. I also remember not having to worry about suffixes in the past. But numerical filenames didn't seem to be an option with split installed on Mac OS X - there was no mention of it in the manual."

If splitting by line, BSD csplit can output numerical filenames.

     wc -l file
   4000
     csplit -s -n 4 file '/$/' '{3998}'
     ls xx????
   xx0000
   xx0001
   xx0002
   ...
   xx3999


Instead of

  for n in {1..456977}; do echo a >> input.txt; done
you could do

  yes | head -n 456977 > input.txt
On my system the latter is ~500 times faster.


If you ever come across this comment, author, note that to some of your readers this renders as a very long, but entirely blank, page.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: