格式化输出IIS绑定格式和批量解析域名
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了格式化输出IIS绑定格式和批量解析域名相关的知识,希望对你有一定的参考价值。
sh name.sh yuming.txt yuming_bak.txt
for name in `cat $1`
do
echo "www.$name||:80:www.$name,:80:$name||d:wwwrootwww.$name" >> $2
done
注:$1是保存要修改的文件名,$2修改后保存的文件名
[[email protected]_client1 domain]# cat modify.sh
#!/usr/bin/bash
file_number=`ls /root/domain/*.txt|wc -l`
#echo $file_number
for i in `ls /root/domain/*.txt`
do
[ ${i##*-} == "1.txt" ] && sh /root/domain/name.sh ${i} ${i}_bak || sh /root/domain/name2.sh ${i} ${i}_bak
done
注:[ ${i##*-} == "1.txt" ] #以判断文件名执行相关脚本
格式化域名和IP解析格式
cat jiexi.sh
#!/usr/bin/bash
path="/root/domain/"
read -p "please input file name number:" file_number
read -p "please input ip before 3 number like:192.168.1:" ip_number
#echo $file_number
#echo $ip_number
cat /root/domain/${file_number}-1.txt > /root/domain/${file_number}_yuming
echo "" >> ${path}${file_number}_yuming
cat /root/domain/${file_number}-2.txt >> /root/domain/${file_number}_yuming
seq -f "${ip_number}.%01g" 3 252 > ${path}${file_number}_ip
#echo "" >> ${path}${file_number}_ip
seq -f "${ip_number}.%01g" 3 252 >> ${path}${file_number}_ip
n=1
ip_line=`cat ${path}${file_number}_ip|wc -l`
while [ ${n} -le ${ip_line} ]
do
ym=`sed -n "${n},${n}p" ${path}${file_number}_yuming` && ip=`sed -n "${n},${n}p" ${path}${file_number}_ip`
echo "${ym},${ip}" >> ${path}${file_number}_format
let n+=1
done
可以简单点,去掉while循环代码,使用:
paste -d , ${path}${file_number}_yuming ${path}${file_number}_ip >> ${path}${file_number}_format
以上是关于格式化输出IIS绑定格式和批量解析域名的主要内容,如果未能解决你的问题,请参考以下文章