-
Notifications
You must be signed in to change notification settings - Fork 0
/
split.sh
35 lines (31 loc) · 884 Bytes
/
split.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
#!/bin/bash
# CONTRIBUTION
## Author: Tom Sapletta
## Created Date: 03.05.2022
# EXAMPLE
# ./split.sh example.com
# CONFIG
domain=$1
CURRENTDATE=`date +"%Y-%m-%d"`
WHOIS_FOLDER="output"
mkdir -p "$WHOIS_FOLDER/cache"
WHOIS_TODAY_FOLDER="$WHOIS_FOLDER/$CURRENTDATE"
#WHOIS_NAMESERVER="$WHOIS_FOLDER/nameserver/$domain.txt"
#WHOIS_REGISTRAR="$WHOIS_FOLDER/registrar/$domain.txt"
WHOIS_CACHE="$WHOIS_FOLDER/cache/$domain.txt"
WHOIS_FILE="$WHOIS_TODAY_FOLDER/$domain.txt"
# START
FIND="For more information on Whois status codes, please visit"
# For more information on Whois status codes,
echo "" > $WHOIS_CACHE
while read -r line; do
echo -e "$line\n"
echo "$line" >> $WHOIS_CACHE
if grep -q "$FIND" <<< "$line"; then
echo "splitted: $WHOIS_FILE"
cat $WHOIS_CACHE > $WHOIS_FILE
sleep 1
rm -f $WHOIS_CACHE
break
fi
done < $WHOIS_FILE