Skip to content

Commit a46109d

Browse files
authored
Update format.sh
1 parent 270acf0 commit a46109d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

format.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ fi
1818
# 使用tr将逗号替换为换行符,然后使用grep和sed来处理文件
1919
# - 使用grep -oP 来匹配以http://, https://, udp://, wss://开头并且以/announce结尾的内容
2020
# - 不进行贪婪匹配
21-
# - 去除每行末尾的所有空格或制表符
21+
# - 使用sed来省略默认端口
2222
tr ',' '\n' < "$input_file" | \
2323
grep -oP '(http|https|udp|wss)://[^/]+/announce' | \
24+
sed -E 's#(http://[^/]+):80/announce#\1/announce#; s#(https://[^/]+):443/announce#\1/announce#' | \
2425
sed 's/[ \t]*$//' > "$output_file"
2526

2627
echo "Formatted trackers have been saved to $output_file"

0 commit comments

Comments
 (0)