split -d -l <no. of lines> <input file> <prefix name>


split -d -l 3 testsplit.txt testsplit.txt.

here, '-d' option will split files with numeric suffix like x00, x01, … x0n

here, '-l' is used to split a file with customize line numbers.

in this case, input file has got 9 rows in it , so above split command will split file into 3 different other files based on prefix name, as shown below.

[root@linux ~]# ls -lrt
-rw-r–r–. 1 root root 50 Nov 11 04:56 testsplit.00
-rw-r–r–. 1 root root 50 Nov 11 04:56 testsplit.01
-rw-r–r–. 1 root root 50 Nov 11 04:56 testsplit.02

Now, these files can be run in parallel as below.

[root@linux ~]# cat script.sh
sh testsplit.00 &
sh testsplit.01 &
sh testsplit.02 &
[root@linux ~]# nohup script.sh &

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.