#!/bin/bash
largo=`wc -l ip|awk '{print $1}'`
echo "Direccion IP | Dueno">salida.txt
echo "--------------------------------">>salida.txt
for ((i=1;i<=largo;i++))
do
ip=$(sed -n ""$i"p" ip|awk '{print $1}')
owner=`whois $ip|grep owner:`
dueno=${owner#*owner:}
echo "$ip | $dueno" >> salida.txt
done
more salida.txt
Tuesday, 13 August 2013
Monday, 12 August 2013
Read a file line by line and separating from fields
#!/bin/bash
largo=`wc -l ip|awk '{print $1}'`
echo "Direccion IP | Dueno">salida.txt
echo "--------------------------------">>salida.txt
for ((i=1;i<=largo;i++))
do
ip=$(sed -n ""$i"p" ip|awk '{print $1}')
owner=`whois $ip|grep owner:`
dueno=${owner#*owner:}
echo "$ip | $dueno" >> salida.txt
done
more salida.txt
largo=`wc -l ip|awk '{print $1}'`
echo "Direccion IP | Dueno">salida.txt
echo "--------------------------------">>salida.txt
for ((i=1;i<=largo;i++))
do
ip=$(sed -n ""$i"p" ip|awk '{print $1}')
owner=`whois $ip|grep owner:`
dueno=${owner#*owner:}
echo "$ip | $dueno" >> salida.txt
done
more salida.txt
Subscribe to:
Posts (Atom)