Wednesday, October 23, 2013

Split a big text file into many files


Suppose that we have a big text file with 2 000 000 lines and you want to split it in 1 000 files containing 20 000 lines each.

You only have one command to type!

split -l 20000 myfile.txt

You will get 1 000 files.

If you are on Windows, you just have to install Cygwin Terminal

Wednesday, October 2, 2013

Batch - Deleting all the files and directories under a root directory


With Windows 7, I need to delete all the files and subdirectory under a root directory.

I was able to achieve this task with theses two commands in a batch script


The first one deletes all the files and directory under MY_DIRECTORY but it deletes also the root directory. I recreate after the root directory.

It may not be the best way to achieve this but it works.