powershell 將文字轉換成表格的另一種方式
阿新 • • 發佈:2019-01-10
$text=" 1 夢幻西遊 216406 2014-01-21 資料片 2 爐石傳說 15905 2014-01-24 公測 3 新大話西遊 214465 2002-08-01 公測 4 問道 11322 2006-04-22 公測 5 沃土 10094 2014-04-23 內測 6 QQ仙靈 10056 2014-06-06 公測 7 神武 10011 2010-09-17 公測 8 大俠Q傳 9576 2014-06-27 內測 9 女神三國 9343 2014-06-28 內測 10 冠軍對決 8809 2014-04-23 公測 11 我欲封天 4447 2014-07-05 公測 12 桃園將星錄 4324 2012-05-24 公測 13 封神 3899 2011-11-24 公測 14 精靈傳說 3779 2013-07-20 內測 15 夢幻隋唐 3462 2014-07-11 公測 16 桃花源記 3289 2013-06-21 內測 17 神鵰俠侶 3112 2012-09-20 公測 18 西遊界 2516 2012-08-31 限量內測 19 夢幻誅仙 22421 2009-10-22 公測 20 三國斬 2313 2010-04-28 內測"
[email protected]() $text.split("`n",[StringSplitOptions]::RemoveEmptyEntries)| %{ $game=""|select 排名,遊戲名稱,熱度值,日期,狀態,備註 $game.排名=$_.split()[0] $game.遊戲名稱=$_.split()[1] $game.熱度值=$_.split()[2] $game.日期=$_.split()[3] $game.狀態=$_.split()[4] $t1+=$game } $t1|Export-Csv "games.csv" -not -Enc oem