Help us understand the problem. What is going on with this article?

Powershellで複数のCSVファイルを読み込んでSortして出力

More than 3 years have passed since last update.

はじめに

前回作った歩引行と実際の売上のデータ行を合成して出力します。

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: ファイルの結合

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away