久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      awk將txt轉換為csv

      從mysql的表中導出來的txt數(shù)據(jù)格式:(mysql -e “select * from table_name;”)

        [admin@93a17e41-ee44-4c53-8432-b196632b8891 ~]$ head choushu.log    1 13 56154 49817 ChargeMain_Shortcut 56154 0.33 1302 0.00863122 0.33863122 2018-09-18  2 7 1169 1066 ChargeMain_Shortcut 56154 0.00687561 39 0.01237113 0.01924674 2018-09-18  3 12 5016 4476 ChargeMain_Shortcut 56154 0.02948286 185 0.01371007 0.04319293 2018-09-18  4 10 781 720 ChargeMain_Shortcut 56154 0.00459549 24 0.01144244 0.01603793 2018-09-18  5 9 1331 1198 ChargeMain_Shortcut 56154 0.00782762 40 0.0112844 0.01911202 2018-09-18  6 14 6394 5262 ChargeMain_Shortcut 56154 0.0375808 196 0.01235227 0.04993307 2018-09-18  7 5 4111 3615 ChargeMain_Shortcut 56154 0.02416454 97 0.00894358 0.03310812 2018-09-18  8 6 1336 1107 ChargeMain_Shortcut 56154 0.007857 164 0.0491426 0.0569996 2018-09-18

      需要轉換為csv格式

      第一種方法就是通過excel,導入,然后固定寬度的方式保存

      有個缺點就是當表特別大的時候,可能會卡主;而且不方便實現(xiàn)自動化;

      我們現(xiàn)在用awk工具實現(xiàn);

      mysql -h address-P port -D database -u username -ppassword -e
      “select * from tb_name;” |awk ‘{for(i=1;i<=NF;i++) {if(i<11) printf $i”,”;else print $i}}’ > choushu.csv

      結果:

        1,13,56154,49817,ChargeMain_Shortcut,56154,0.33,1302,0.00863122,0.33863122,2018-09-18  2,7,1169,1066,ChargeMain_Shortcut,56154,0.00687561,39,0.01237113,0.01924674,2018-09-18  3,12,5016,4476,ChargeMain_Shortcut,56154,0.02948286,185,0.01371007,0.04319293,2018-09-18  4,10,781,720,ChargeMain_Shortcut,56154,0.00459549,24,0.01144244,0.01603793,2018-09-18  5,9,1331,1198,ChargeMain_Shortcut,56154,0.00782762,40,0.0112844,0.01911202,2018-09-18  6,14,6394,5262,ChargeMain_Shortcut,56154,0.0375808,196,0.01235227,0.04993307,2018-09-18  7,5,4111,3615,ChargeMain_Shortcut,56154,0.02416454,97,0.00894358,0.03310812,2018-09-18

      直接雙擊打開

      awk將txt轉換為csv

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號