Browse code

examples: moved to misc directory

Daniel-Constantin Mierla authored on 07/12/2016 13:56:54
Showing 1 changed files
1 1
deleted file mode 100755
... ...
@@ -1,53 +0,0 @@
1
-#!/bin/sh 
2
-#
3
-# $Id$
4
-#
5
-# utility for displaying geographical break-down of usrloc population
6
-# it takes functional netgeo support for ser (currently, an
7
-# experimental unavailable feature)
8
-# 
9
-
10
-
11
-DB_HOST=dbhost
12
-DB_USER=ser
13
-DB_PW=heslo
14
-
15
-# ---
16
-
17
-TMP=/tmp/geo_split.$$
18
-
19
-stats()
20
-{
21
-	DOMAIN_CNT=`grep $1 $TMP | wc | awk ' { print $1  } '`
22
-	if [ "$DOMAIN_CNT" -eq "0" ] ; then
23
-		PC="0"
24
-	else
25
-		PC=`expr $DOMAIN_CNT \* 100 / $2`
26
-	fi
27
-	printf "$1: $DOMAIN_CNT $PC %%\n"
28
-	grep -v $1 $TMP > $TMP.2
29
-	mv $TMP.2 $TMP
30
-}
31
-
32
-mysql -h $DB_HOST --batch -u $DB_USER -p$DB_PW ser -e "select location from netgeo_cache" |
33
-awk -F '/' '
34
-	BEGIN { line=0 }
35
-	{ line++ }
36
-	line==1 { next; } # skip heading
37
-	length()==0 { next; } # skip empty lines
38
-	/^[A-Z][A-Z ]*\/[A-Z ]+/ { print $2; next;} 
39
-	/^[A-Z]+/ { print " " $1; next;} 
40
-	/^ [A-Z]+/ { print $1; next;} 
41
-	{ print "error" > "/dev/stderr" }' |
42
-sort -b > $TMP
43
-
44
-export TOTAL_CNT=`wc $TMP|awk '{print $1}'`
45
-
46
-printf "Total: $TOTAL_CNT\n"
47
-(for i in AU DE US NL CZ UK RO RU TR TW SW JP CA HK IT AR BE CN FI GL IN KR SE UY; do 
48
-	stats $i $TOTAL_CNT
49
-done) 
50
-#| sort
51
-cat $TMP
52
-
53
-rm $TMP*
Browse code

config values moved to variables

Jiri Kuthan authored on 24/04/2003 19:22:25
Showing 1 changed files
... ...
@@ -7,6 +7,13 @@
7 7
 # experimental unavailable feature)
8 8
 # 
9 9
 
10
+
11
+DB_HOST=dbhost
12
+DB_USER=ser
13
+DB_PW=heslo
14
+
15
+# ---
16
+
10 17
 TMP=/tmp/geo_split.$$
11 18
 
12 19
 stats()
... ...
@@ -22,7 +29,7 @@ stats()
22 29
 	mv $TMP.2 $TMP
23 30
 }
24 31
 
25
-mysql -h dbhost --batch -u ser -pheslo ser -e "select location from netgeo_cache" |
32
+mysql -h $DB_HOST --batch -u $DB_USER -p$DB_PW ser -e "select location from netgeo_cache" |
26 33
 awk -F '/' '
27 34
 	BEGIN { line=0 }
28 35
 	{ line++ }
Browse code

initiatl check-in

Jiri Kuthan authored on 24/04/2003 19:21:15
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,46 @@
1
+#!/bin/sh 
2
+#
3
+# $Id$
4
+#
5
+# utility for displaying geographical break-down of usrloc population
6
+# it takes functional netgeo support for ser (currently, an
7
+# experimental unavailable feature)
8
+# 
9
+
10
+TMP=/tmp/geo_split.$$
11
+
12
+stats()
13
+{
14
+	DOMAIN_CNT=`grep $1 $TMP | wc | awk ' { print $1  } '`
15
+	if [ "$DOMAIN_CNT" -eq "0" ] ; then
16
+		PC="0"
17
+	else
18
+		PC=`expr $DOMAIN_CNT \* 100 / $2`
19
+	fi
20
+	printf "$1: $DOMAIN_CNT $PC %%\n"
21
+	grep -v $1 $TMP > $TMP.2
22
+	mv $TMP.2 $TMP
23
+}
24
+
25
+mysql -h dbhost --batch -u ser -pheslo ser -e "select location from netgeo_cache" |
26
+awk -F '/' '
27
+	BEGIN { line=0 }
28
+	{ line++ }
29
+	line==1 { next; } # skip heading
30
+	length()==0 { next; } # skip empty lines
31
+	/^[A-Z][A-Z ]*\/[A-Z ]+/ { print $2; next;} 
32
+	/^[A-Z]+/ { print " " $1; next;} 
33
+	/^ [A-Z]+/ { print $1; next;} 
34
+	{ print "error" > "/dev/stderr" }' |
35
+sort -b > $TMP
36
+
37
+export TOTAL_CNT=`wc $TMP|awk '{print $1}'`
38
+
39
+printf "Total: $TOTAL_CNT\n"
40
+(for i in AU DE US NL CZ UK RO RU TR TW SW JP CA HK IT AR BE CN FI GL IN KR SE UY; do 
41
+	stats $i $TOTAL_CNT
42
+done) 
43
+#| sort
44
+cat $TMP
45
+
46
+rm $TMP*