Answer the question
In order to leave comments, you need to log in
Convert strings to columns bash?
There is a script which does whois and pulls out the necessary fields:
for as in $(cat as.txt):
do echo $as;
whois -h whois.radb.net -i origin $as > whoisas
route=`cat whoisas | grep route: | sed s/route:/\;/g`
descr=`cat whoisas | grep descr: | sed s/descr:/\;/g`
route6=`cat whoisas | grep route6: | sed s/route6:/\;/g`
echo -e $route"\n\r"$descr"\n\r"$route6
done>as.csv
But in csv they are dumped in rows, it is desirable to make them in columns
Answer the question
In order to leave comments, you need to log in
while read; do
RESULT=$(whois -h whois.radb.net -i origin $REPLY)
route=$(echo "$RESULT"|grep -oP "route:\s*\K.*")
descr=$(echo "$RESULT"|grep -oP "descr:\s*\K.*")
route6=$(echo "$RESULT"|grep -oP "route6:\s*\K.*")
echo "$REPLY;$route;$descr;$route6;"
done<as.txt>as.csv
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question