##はじめに
前回作った歩引行と実際の売上のデータ行を合成して出力します。
sales.csv
id,detail_id,item,price,discount_per,discount_price
0,1,letsnote,2000,8,160
1,1,macbookair,1230,8,98.4
2,1,macbookpro,998,8,79.84
discounts.csv
"id","detail_id","item","price","discount_per","discount_price"
"0","998","8%","-160","8","160"
"1","998","8%","-98.4","8","98.4"
"2","998","8%","-79.84","8","79.84"
2つのCSVファイルを読み込んで結合して出力
PS >$sales=Import-Csv -path sales.csv,discounts.csv
PS >$sales=$sales | sort id,detail_id
PS >$sales | Export-Csv -path sales.csv
sales.csv
"id","detail_id","item","price","discount_per","discount_price"
"0","1","letsnote","2000","8","160"
"0","998","8%","-160","8","160"
"1","1","macbookair","1230","8","98.4"
"1","998","8%","-98.4","8","98.4"
"2","1","macbookpro","998","8","79.84"
"2","998","8%","-79.84","8","79.84"
##参考サイト
第2回チキチキ!シェル芸人養成勉強会をPowerShellでやってみた
の問題10: ファイルの結合