forked from EA7KDO/NX4832K035
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetuserinfo.sh
executable file
·64 lines (58 loc) · 1.42 KB
/
getuserinfo.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
############################################################
# Get Name From: #
# /usr/local/etc/stripped.csv using call sign or dgid #
# as key #
# Pass call sign or dgid in $1 #
# Pass Field Number in $2 #
# #
# #
# KF6S/VE3RD 2020-11-24 #
############################################################
set -o errexit
if [ -z "$1" ]; then
exit
fi
#NAME=$(cat /usr/local/etc/stripped.csv | grep -w -F $1 | head -1 | awk -F, '{print $3}')
#mt=$(sudo sed -n '/'"$1"'/p' /usr/local/etc/stripped.csv | head -1 | cut -d',' -f1)
mt=$(sudo sed -n '/'"$1"'/p' /usr/local/etc/stripped.csv | head -1)
if [ -z "$mt" ]; then
echo "Not Found"
exit
fi
Id=$(echo "$mt" | cut -d',' -f1)
Call=$(echo "$mt" | cut -d',' -f2)
Name1=$(echo "$mt" | cut -d',' -f3)
Name2=$(echo "$mt" | cut -d',' -f4)
City=$(echo "$mt" | cut -d',' -f5)
State=$(echo "$mt" | cut -d',' -f6)
Country=$(echo "$mt" | cut -d',' -f7)
case "$2" in
"1")
echo "$Id"
;;
"2")
echo "$Call"
;;
3)
echo "$Name1"
;;
4)
echo "$Name2"
;;
5)
echo "$City"
;;
6)
echo "$State"
;;
7)
echo "$Country"
;;
34)
echo "$Name1 $Name2"
;;
567)
echo "$City $State $Country"
;;
esac