I have a text file which contains exactly thousand lines. I want to split the file into 1000 different files by writing each line to a separate text file. And i want the name of splitted files to be in a sequential order.
Example:
foo.txt
file contains,
foo
bar
...
...
lastfoo
First Splitted file must contain only a single line foo
and it's name would be bar1.txt
. And the second file must contain only a single line bar
and it's name would be bar2.txt
likewise for the last file should contain a line lastfoo
and the name of the last file would be bar1000.txt
.
Command-line(One liner) way would be better rather than a script way.