Skip to content

Commit

Permalink
Merge pull request #26 from btdn/master
Browse files Browse the repository at this point in the history
Increase Portability to BSD
  • Loading branch information
wbrenna authored Jun 20, 2019
2 parents 2abe7e8 + 74a912e commit c37c821
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions data/mksql3db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ do
stops.txt)
table=$(echo `basename $file` | sed -e 's/\..*//')
columns="stop_sorted,$(cat $file | tr -d '\015' | head -n 1 | sed -e '1 s/^\xef\xbb\xbf//')"
#tail -n +2 "$file" | sort -k6 -g -t, | cat -n -s | awk '{ $1 = $1","; print}' > $tmpfile
tail -n +2 $file | awk '{$1=$1};1' | sort -k6 -g -t, | grep -n '^' - | sed -e '/^$/d' | sed -e 's/,\ */,/g' | sed -e 's/\([0-9]\):/\1,/g' > $tmpfile
#tail -n +2 "$file" | sort -k6 -n -t, | cat -n -s | awk '{ $1 = $1","; print}' > $tmpfile
tail -n +2 $file | awk '{$1=$1};1' | sort -k6 -n -t, | grep -n '^' - | sed -e '/^$/d' | sed -e 's/,\ */,/g' | sed -e 's/\([0-9]\):/\1,/g' > $tmpfile
(
echo "create table $table($columns);"
echo ".separator ,"
Expand Down Expand Up @@ -242,7 +242,9 @@ mv $DB.version $DB.version.old
gzip -9v -c $DB > $DB.gz
md5=$(md5sum $DB | cut -f1 -d' ')
#md5=$(md5 -q $DB)
size=$(stat -c "%s" $DB.gz)
#size=$(stat -f "%z" $DB.gz)
sizem=$(echo "1k $size 512+ 1024/1024/p" | dc)
echo "$version $sizem $md5" > $DB.version
Expand Down

0 comments on commit c37c821

Please sign in to comment.