-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetuserinfo.sh
More file actions
executable file
·77 lines (70 loc) · 1.67 KB
/
getuserinfo.sh
File metadata and controls
executable file
·77 lines (70 loc) · 1.67 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/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
call="$1"
#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 '/'"$call",'/p' /usr/local/etc/stripped.csv | head -1)
if [ -z "$mt" ]; then
mt=$(sudo sed -n '/'"$call",'/p' /usr/local/etc/stripped2.csv | head -1)
if [ -z "$mt" ]; then
echo "Not Found"
exit
fi
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)
if [ -z "$2" ]; then
mode="3567"
else
mode="$2"
fi
case "$mode" 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"
;;
3567)
echo "$Name1|$City|$State|$Country"
;;
esac