{"id":9142,"date":"2021-11-30T23:29:14","date_gmt":"2021-11-30T23:29:14","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=9142"},"modified":"2021-11-30T23:29:33","modified_gmt":"2021-11-30T23:29:33","slug":"solved-split-file-into-multiple-files-using-windows-batch","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/split-file-into-multiple-files-using-windows-batch\/29892.html","title":{"rendered":"Solved Split File Into Multiple Files Using Windows Batch"},"content":{"rendered":"<p>Important is, that every subfile is separated by $$$$<\/p>\n<p>So the data look like: file test.sdf<\/p>\n<p>line1<br \/>\nline2<br \/>\nline3<br \/>\nline4<br \/>\n$$$$<br \/>\nline6<br \/>\nline7<br \/>\nline8<br \/>\nline9<br \/>\nline10<br \/>\n$$$$<br \/>\netc.<br \/>\nand I need have separated files<\/p>\n<p>file1.mol<\/p>\n<p>line1<br \/>\nline2<br \/>\nline3<br \/>\nline4<br \/>\nfile2.mol<\/p>\n<p>line6<br \/>\nline7<br \/>\nline8<br \/>\nline9<br \/>\nline10<br \/>\netc.<\/p>\n<p>I tried to write a script but it looks like it does not work. I will really appreciate if someone could help me. I am not comfortable with batch and rather use bash, but I need to learn something new&#8230;<\/p>\n<p>here is my code:<\/p>\n<p>@ECHO OFF<\/p>\n<p>SET &#8220;destdir=C:\\Users\\miru\\Desktop&#8221;<br \/>\nSET &#8220;extensions=mol&#8221;<\/p>\n<p>SET &#8220;output=&#8221;<\/p>\n<p>FOR \/f &#8220;delims=&#8221; %%a IN (test.sdf) DO (<br \/>\nIF &#8220;%%a&#8221;==&#8221;$$$$&#8221; (SET &#8220;output=Y&#8221;&amp;SET; &#8220;ext=&#8221;<br \/>\n) ELSE (<br \/>\nIF DEFINED output (<br \/>\nIF NOT DEFINED ext FOR %%s IN (%extensions%) DO IF \/i &#8220;%%a&#8221;==&#8221;%%s&#8221; SET &#8220;ext=%%s&#8221;<br \/>\n)<br \/>\n)<\/p>\n<p>GOTO :EOF<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":25},"question-category":[55],"question_tags":[],"class_list":["post-9142","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/9142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=9142"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=9142"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=9142"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=9142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}