Skip to content

Instantly share code, notes, and snippets.

View Loveforkeeps's full-sized avatar
🐶
Meow~

EMoDevil Loveforkeeps

🐶
Meow~
View GitHub Profile
@Loveforkeeps
Loveforkeeps / checkmd.sh
Created October 18, 2017 07:43
MD文档格式更正,###后无空格则添加空格
#!/bin/bash
for index in `cat -n $1 | grep -vE '#+\s'| grep -E '#+' | awk '{print $1}'`;
do
echo "第"$index"行";
arg="sed -i '.bak' '${index}s/\#\{1,\}/& /g' $1"
echo $arg | sh
done
@Loveforkeeps
Loveforkeeps / extractDomain.sh
Last active October 25, 2017 08:09
Ubuntu和Mac平台,PDNS数据处理,样例数据:ali1.rabbitpre.com.|117.169.81.237:27|117.169.81.219:29|117.169.81.217:25|117.169.81.236:20|117.169.81.218:38|223.82.136.179:9|223.82.136.174:8|223.82.136.178:10|223.82.136.177:12|223.82.136.176:14|223.82.136.175:15|117.169.81.221:30|223.82.136.228:15|117.169.81.220:32|223.82.136.229:18|117.169.81.222:25|
#!/bin/bash
# Mac 上 readlink -f 无法使用的替代代码
TARGET_FILE=$0
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
while [ -L "$TARGET_FILE" ]
do
@Loveforkeeps
Loveforkeeps / dns.sh
Created October 17, 2017 03:05
DNS查询ip
#!/bin/bash
for name in `cat domian.txt`;
do
nslookup $name| grep -E 'Add|Nam' |awk -v awk_var="$name" '!/#/{printf awk_var" "$2"\n"}' >> dns.txt
done
awk '{if(NR%2==0){printf $2 "\n"}else{printf "%s ",$0}}' dns.txt > ipoder.txt
#sort -k 3 ipoder.txt -o dns.txt
#rm -f ipoder.txt
awk '{printf "%-40s|%-60s|%-20s\n", $1, $2, $3;}' dns.txt > order.txt