{"id":168,"date":"2010-11-30T09:41:04","date_gmt":"2010-11-30T14:41:04","guid":{"rendered":"http:\/\/www.hpux.ws\/?p=168"},"modified":"2010-11-30T09:41:04","modified_gmt":"2010-11-30T14:41:04","slug":"awk-trick-of-the-day-parsing-comma-delimited-input-to-a-sequential-file","status":"publish","type":"post","link":"https:\/\/www.hpux.ws\/?p=168","title":{"rendered":"awk trick of the day. Parsing comma delimited input to a sequential file"},"content":{"rendered":"<p>Lets say I have a list of servers a mile long to visit.\u00a0 Got a help desk request with the servers listed separated by commas.<\/p>\n<p>server1,server2,server3<\/p>\n<p>Lets say It is actually about 30 or 40 servers and I&#8217;m too lazy to edit the list<\/p>\n<p>echo &#8220;server1,server2,server3&#8221; &gt; olist<\/p>\n<p><strong>awk -F, -v nr=1 &#8216;{ for (x=nr; x&lt;=NF; x++) {printf $x &#8221; \\n&#8221;; }; print &#8221; &#8221; }&#8217; olist<\/strong><\/p>\n<p>Output:<\/p>\n<p>server1<\/p>\n<p>server2<\/p>\n<p>server3<\/p>\n<p>Plug and play time here, you can take care of any delimited format like this.<\/p>\n<p>Spaces input by wordpress (thanks)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lets say I have a list of servers a mile long to visit.\u00a0 Got a help desk request with the servers listed separated by commas. server1,server2,server3 Lets say It is actually about 30 or 40 servers and I&#8217;m too lazy to edit the list echo &#8220;server1,server2,server3&#8221; &gt; olist awk -F, -v nr=1 &#8216;{ for (x=nr; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_kadence_starter_templates_imported_post":false,"footnotes":""},"categories":[39,8],"tags":[49,50,48],"class_list":["post-168","post","type-post","status-publish","format-standard","hentry","category-scripting","category-sysadmin","tag-awk","tag-awkful","tag-scripting-2"],"_links":{"self":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/168"}],"collection":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":2,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hpux.ws\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}