{"id":10376,"date":"2021-12-05T11:49:47","date_gmt":"2021-12-05T11:49:47","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=10376"},"modified":"2021-12-05T11:50:31","modified_gmt":"2021-12-05T11:50:31","slug":"how-do-i-output-the-first-word-in-text-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-do-i-output-the-first-word-in-text-file\/24928.html","title":{"rendered":"How Do I Output The First Word In Text file?"},"content":{"rendered":"<p>i&#8217;m trying to write a batch file that sets a variable to the first word in a text file.<br \/>\ni can get it to find the first word in the text file using the findstr command, but it outputs the entire line, this is what i have so far:<\/p>\n<p>@echo off<br \/>\nfor \/f &#8220;tokens=*&#8221; %%a in (&#8216;findstr \/b \/i &#8220;\\&lt;.*\\&gt;&#8221; &#8220;%cd%\\somthing.txt&#8221;&#8216;) do set a=%%a<br \/>\necho %a%<br \/>\npause<\/p>\n<p>but even though it is picking up on the first word, it outputs the whole line, and i can&#8217;t find any commands to make it output just the first word.<br \/>\ndoes anyone have an idea of how to make this output the first word? or possibly even a completely new command to do so. thanks a heap for any suggestions \ud83d\ude42<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":18},"question-category":[55],"question_tags":[],"class_list":["post-10376","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\/10376","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=10376"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=10376"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=10376"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=10376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}