root/mappings/join @ 698
1 | 184 | aaronmk | #!/bin/bash
|
---|---|---|---|
2 | 198 | aaronmk | # Joins all *-$1.csv to $1-$2.csv
|
3 | 70 | aaronmk | |
4 | selfDir="$(dirname -- "$0")" |
||
5 | cd "$selfDir" |
||
6 | |||
7 | 198 | aaronmk | test "$#" -eq 2 || { echo "Usage: $0 from to" >&2; exit 2;} |
8 | |||
9 | for map in *-$1.*.csv; do |
||
10 | 158 | aaronmk | type="${map%.*}" # remove extension |
11 | 70 | aaronmk | type="${type#*.}" # remove up to last "." |
12 | 274 | aaronmk | ../bin/join <"$map" "$1-$2.$type.csv"|\ |
13 | ../bin/sort 1 0 >"${map/$1/$2}" # sort on output col |
||
14 | 70 | aaronmk | done
|