aboutsummaryrefslogtreecommitdiff
path: root/query-prefixes
blob: 746dc01e48df2cf504b4aefbde3d6c6fc02a5851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -e
. common.sh

PIPE_NAME="$$.fifo.tmp"

if [ "$1" == "-6" ]; then
	Q_PREFIX='!6'
else
	Q_PREFIX='!g'
fi

read_aslist () {
	local asn

	while read asn
	do
		echo ${Q_PREFIX}${asn}
	done
}

output_filter () {
	local a
	local b

	while read -u 3 a && read -d '' b
	do
		printf '%-12s\t%s\n' "$a" "$b"
	done
}


set -o pipefail
read_aslist | open_db | extract_answer | output_filter