/[A3C]/data/stats/import-tsv.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /data/stats/import-tsv.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 245 - (hide annotations)
Mon Oct 13 11:55:14 2008 UTC (15 years, 7 months ago) by dpavlin
File MIME type: application/x-sh
File size: 380 byte(s)
beginning of stats reporter

1 dpavlin 245 pipe=/tmp/strix-import
2     db=a3c
3    
4     if [ -z "$1" ] ; then
5     echo "Usage: $0 export.tsv"
6     exit
7     else
8     file=$1
9     table="strix_`basename $file | sed 's/.tsv$//'`";
10     fi
11    
12     mkfifo $pipe
13    
14     echo "** importing $table from $1"
15    
16     psql -c "delete from $table" $db
17     psql -c "\copy $table from '$pipe' with delimiter ' '" $db &
18     cat -n $file | sed 's/^ *//' > $pipe
19     psql -c "select count(*) from $table" $db

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26