I have a file named Me_thread_spell.txt that I want to split into smaller files. I want it to be split in each place there is a ;;;. For example,
blah blah blah ;;;
blah bhlah hlabl
awasnceuir
asenduhfoijhacseiodnbfxasd;;;
oabwcuhaweoir;;;
This full file would be three separate files (separated into files by the ;;
.
Then I want to rename the resulting files with "comment" and then a series of numbers, such as comment1.txt, comment2.txt, comment3.txt... etc. up to comment2500.txt.
I've been working on splitting and renaming in Terminal and this is all I have come up with so far (below), and it doesn't split the files correctly and it doesn't rename the files. Please help!
split -p ';;;' Me_thread_spell.txt FILE && for file in FILE*; do mv $comment "$(sed '0-9')".txt; done
I'm pretty much lost at this point. I am running Mac OS X with bin/bash. I've been told a script would be easier, but I am not sure how to make one.