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