{"id":4095,"date":"2021-11-08T12:16:06","date_gmt":"2021-11-08T12:16:06","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=4095"},"modified":"2021-11-08T12:16:29","modified_gmt":"2021-11-08T12:16:29","slug":"solved-how-to-use-command-prompt-to-edit-csv-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-use-command-prompt-to-edit-csv-file\/30992.html","title":{"rendered":"Solved How To Use Command Prompt To Edit CSV File"},"content":{"rendered":"<p>I would like to<\/p>\n<p>1) Delete the first three lines of a CSV file<br \/>\n2) Replace the new 1st header row (was the 4th row) with new headers on each of the columns.<br \/>\n3) Delete Columns 1, 5, 6, 7, 8, and 25.<\/p>\n<p>I&#8217;ve tried some commands on own, including:<\/p>\n<p>cat C14bOrigHdrs.csv | sed \u201c1 d\u201d &gt; remove-row1.csv<\/p>\n<p>cat remove-row1.csv | sed \u201c1 d\u201d &gt; remove-row2.csv<\/p>\n<p>cat remove-row2.csv | sed \u201c1 d\u201d &gt; remove-row3.csv<\/p>\n<p>sed -i &#8216;1s\/.*\/MRN &amp; Pt Name,DOB,Pt Name,Txn Date,Txn Time,Item Code,Item Description,Order\/RX#,User,Dept,AttendDocName,Description,Txn Type,NotesFromIssue,Issue Dose,Waste,UOM,Machine,Bin,Cost\/Charge,Item Description &#8211; Total per Item per Patient (TPIPP),Net Disp (TPIPP),Net Waste (TPIPP),UOM,Net Charge (TPIPP),Delete,Delete,Delete,Delete,Delete,Delete,Delete,Delete\/&#8217; newheaders.csv<\/p>\n<p>cut -d, -f 1\u20137,13,15-17,20,22-25 newheaders.csv &gt; NeedToRemoveDuplicates.csv<\/p>\n<p>Unfortuantely, I get an error message right away saying &#8220;&#8216;cat&#8217; is not recognized as an internal or external command, operable program or batch file.&#8221;<\/p>\n<p>Any advice on what I&#8217;m doing wrong?<\/p>\n<p>Thanks!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":12},"question-category":[55],"question_tags":[],"class_list":["post-4095","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\/4095","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=4095"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=4095"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=4095"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=4095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}