{"id":7508,"date":"2021-11-24T09:49:08","date_gmt":"2021-11-24T09:49:08","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=7508"},"modified":"2021-11-24T09:52:20","modified_gmt":"2021-11-24T09:52:20","slug":"batch-file-to-extract-context-from-text-file-to-csv-format","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-file-to-extract-context-from-text-file-to-csv-format\/27986.html","title":{"rendered":"Batch File To Extract Context From Text File To Csv Format"},"content":{"rendered":"<p>i need to extract some content from following information (source file)<br \/>\n* *<br \/>\n* * * * * * * * * User information . . . . . :<br \/>\nUser name . . . . . . . . . : ABAX * * * * * * * * *<br \/>\n* User text . . . . . . . . . : Beatrice Raffaele *<br \/>\nBegin menu . . . . . . . . : *NONE<br \/>\nGroup jobs . . . . . . . . : 15<br \/>\nEnd group jobs . . . . . . : *NO<br \/>\nCommand line on menus . . . : *NO<br \/>\nAttention-key program . . . : *ACTIVE<br \/>\nReference user . . . . . . : OPERATOR<br \/>\n=====================================================================================================================================<\/p>\n<p>* * * * * * * * * User information . . . . . : User name . . . . . . . . . : ABCG * * * * * * * * *<br \/>\n* User text . . . . . . . . . : Barchiesi Giancarlo *<br \/>\nBegin menu . . . . . . . . : *NONE<br \/>\nGroup jobs . . . . . . . . : 15<br \/>\nEnd group jobs . . . . . . : *NO<br \/>\nCommand line on menus . . . : *NO<br \/>\nAttention-key program . . . : *ACTIVE<br \/>\nReference user . . . . . . : OPERATOR<br \/>\n=====================================================================================================================================<\/p>\n<p>and the list go on,,,<\/p>\n<p>my desire output is<br \/>\nuser name , User text , Begin menu , Group jobs , End group jobs , Command line on menus , &#8230;.<br \/>\nBeatrice .. , *NONE ,<br \/>\nBarchiesi ,<br \/>\nbasically will have a column header and follow by the entries&#8230;<\/p>\n<p>i read somewhere<br \/>\nfor \/f &#8220;tokens=*&#8221; %%a in (&#8216;find \/i &#8220;User name&#8221; ^&lt;..\\abc.txt&#8217;) do (<br \/>\nset %%a<\/p>\n<p>(echo User name: !user name!<br \/>\necho user text: !user text!<br \/>\necho Begin menu : !Begin menu!<br \/>\necho Group jobs : !Group jobs!<br \/>\necho End group jobs : !End group jobs!<br \/>\necho Command line on menus : !command line on menus!<br \/>\necho Attention-key program : !Attention-key program!<br \/>\necho Reference user : !Reference user!<br \/>\n)&gt;&gt;output.txt<br \/>\n)<\/p>\n<p>but this doesn&#8217;t work on my case.. would appreciate someone reply &#8230;thanks!!!<\/p>\n<p>EDIT:<\/p>\n<p>Sorry for the typo<\/p>\n<p>in fact the ouput shall be..<\/p>\n<p>User name User text Begin menu &#8230;&#8230;<br \/>\nABAX Beatrice Raffaele *NONE<br \/>\nABCG Barchiesi Giancarlo *NONE<\/p>\n<p>something like this&#8230; and continue to the rest of the row<br \/>\n\ud83d\ude42 thanks.. would appreciate for the help..<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":2},"question-category":[55],"question_tags":[],"class_list":["post-7508","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\/7508","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=7508"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=7508"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=7508"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=7508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}