AWK
1#!/usr/bin/awk -f
2function registerStation(station, stationIndex) {
3 for (stationIndex = 0; stationIndex < stationCount; stationIndex++) {
4 if (stationList[stationIndex] == station) {
5 return stationIndex;
6 }
7 }
8
9 stationList[stationCount++] = station;
10 return stationCount;
11}
12
13
14{
15 station = $1;
16 registerStation(station);
17
18 passengers = $2;
19
20 passengersAtStation[station] = passengers;
21}
22
23
24END {
25 for (stationIndex = 0; stationIndex < stationCount; stationIndex++) {
26 station = stationList[stationIndex];
27 printf("%s\t%s\n", station, passengersAtStation[station]);
28 }
29}
bash
1chmod a+x joinStationList.awk # 上記ファイル
2./joinStationList.awk data2.csv data1.csv > data3.csv
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/02 15:37
2017/05/02 22:58 編集
2017/05/04 00:27
2017/05/04 05:36 編集
2017/05/04 16:51
2017/05/04 23:00
2017/05/05 01:21
2017/05/05 02:09
2017/05/05 02:09
2017/05/05 02:14
2017/05/05 02:24