I have a script which is every minute detecting new files in a folder and parsing them.
Lately I have had issues with big files. The parser hangs out if the file is very big.
So I am splitting them if the size is too big. I am using this command for that:
split -n l/5 -d filename filename
I calculate the chunk number dividing the size by an acceptable size for the parser.
Now it comes the tricky part. The first two lines of the file I am splitting are very important and I need to add those two lines at the top of the resulting files.
It would be great if I can do it in the same command line somehow parsing the resulting split files... Size is variable and I can have 20 new files or just 2 so I cannot foresee the which is the original file of the resulting files.
split
have a--filter
option: does yours? – steeldriver Feb 08 '17 at 13:04