root/bin/import_name @ 6575
1 |
#!/bin/sh
|
---|---|
2 |
# Gets the name of an import based on its log file names
|
3 |
# Usage: self logs...
|
4 |
|
5 |
sedEreFlag="$(test "$(uname)" = Darwin && echo E || echo r)" |
6 |
|
7 |
sed () { "$(which sed)" -"$sedEreFlag" "$@";} |
8 |
|
9 |
if ! test "$#" -ge 1; then |
10 |
echo "Usage: self logs..."|fold -s >&2 |
11 |
exit 2
|
12 |
fi
|
13 |
|
14 |
for log in "$@"; do |
15 |
echo "$log"|sed -n 's/^.*\/logs\/(.*)\.log\.sql$/\1/p' |
16 |
break # only for first log file |
17 |
done
|