So, i have a domain name querying script.. it generates 4 char strings, then adds .com to the end and does a whois on them. When whois returns 0, it prints 'blah.com: available' in a text file (/tmp/list.txt).
So, while this is running, i'm tailing /tmp/list.txt.. I also have stderr going there because I get a few different errors during the runtime:
The /tmp/list.txt file will look something like this:
I don't want to see the errors or the line underneath them because it returns true, saying they're available when they actually aren't.
I came up with this so far:
which hides the Timeout line along w/ the one underneath it, but how can I add the fgets and unreachable strings matches to it?
I know I can use
@JasKinasis and @dos2unix i'm looking at you guys! lol
Edit: here's the scripts involved .. to make it easier to understand... i'll fire it off by running the domain-search.sh script.
domain-search.sh:
check-avail.sh:
So, while this is running, i'm tailing /tmp/list.txt.. I also have stderr going there because I get a few different errors during the runtime:
Code:
Timeout.
fgets: Connection reset by peer
connect: Network is unreachable
The /tmp/list.txt file will look something like this:
Code:
Timeout.
ohlm.com available
Timeout.
iuqr.com available
blah.com available
fgets:Connection reset by peer
blah2.com available
Timeout.
negd.com available
Timeout.
fhjj.com available
I don't want to see the errors or the line underneath them because it returns true, saying they're available when they actually aren't.
I came up with this so far:
tail -f /tmp/list.txt|sed '/Timeout/,+1d'
which hides the Timeout line along w/ the one underneath it, but how can I add the fgets and unreachable strings matches to it?
I know I can use
grep -v
to hide a string, but I don't believe I can add an A
to strip out the line under it..@JasKinasis and @dos2unix i'm looking at you guys! lol
Edit: here's the scripts involved .. to make it easier to understand... i'll fire it off by running the domain-search.sh script.
domain-search.sh:
Code:
#!/bin/bash
touch /tmp/list.txt
while true; do /usr/local/bin/check-avail.sh $(cat /dev/urandom | tr -dc 'a-z' | fold -w 4 | head -n 1) >> /tmp/list.txt 2>&1;sleep 20;done &
#while true; do /usr/local/bin/check-avail.sh $(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1) >> /tmp/list.txt;sleep 20;done &
#for i in $(sort --random-sort /usr/local/bin/word_list.txt);do /usr/local/bin/check-avail.sh $i >> /tmp/list.txt 2>&1;sleep 20;done &
check-avail.sh:
Code:
#!/bin/bash
#for domain in com net info org pro; do
for domain in com; do
if ! whois ${1}.$domain >> /dev/null; then
echo "${1}.$domain available"
fi
done
Last edited: