批量提取多个txt文件的下载地址到一个新的txt文件中

问题描述 投票:0回答:1

我有很多txt文件,其中包含以下单词。downloadaddress.

我只想要下载地址 1fichier 网站,所以我写了一个批次,如下。

set pa="C:\download"
for /r %pa% %%a in (*.txt) do type %%~fa|Findstr "hxxps://1fichier.com/" >> getdownload.txt

getdownload.txt result:

h53tnzhh0514dsvr00700.xjl5xtqg.part1.rar : hxxps://1fichier.com/?oesuw9ty9lkhh2wbj5us
h53tnzhh0514dsvr00700.xjl5xtqg.part2.rar : hxxps://1fichier.com/?exgrcaza0i2cjmwpyvpb

我只想要 hxxps://1fichier.com/?oesuw9ty9lkhh2wbj5ushxxps://1fichier.com/?exgrcaza0i2cjmwpyvpb而不是文件名。h53tnzhh0514dsvr00700.xjl5xtqg.part1.rar :h53tnzhh0514dsvr00700.xjl5xtqg.part2.rar : 零件

我如何才能得到如下结果。

hxxps://1fichier.com/?oesuw9ty9lkhh2wbj5us
hxxps://1fichier.com/?exgrcaza0i2cjmwpyvpb

我有大约 20 txt文件,其中包含以下内容

115 download address: 

ed2k://|file|h53tnzhh0514dsvr00700.xjl5xtqg.part1.rar|12884901888|2B958C84EF5C4BDE5B1031DC9ACAAE7C|h=NFRHBEWYTMQNYAQ3FVHEU5UFEJ2CMZ44|/
ed2k://|file|h53tnzhh0514dsvr00700.xjl5xtqg.part2.rar|1135932776|87EF320F80F201AB66B19E23D9AA999F|h=X3MKSWI7ZLBKOJDXBC3CKJVSALEGSO7S|/


1fichier download address:

h53tnzhh0514dsvr00700.xjl5xtqg.part1.rar : hxxps://1fichier.com/?oesuw9ty9lkhh2wbj5us

h53tnzhh0514dsvr00700.xjl5xtqg.part2.rar : hxxps://1fichier.com/?exgrcaza0i2cjmwpyvpb
batch-file command findstr
1个回答
1
投票

对我来说,最简单有效的方法是使用 FindStr 直接。

@Echo Off & SetLocal EnableExtensions
Set "pa=C:\download"
(   For /F "Tokens=2*" %%G In (
        '%__AppDir__%findstr.exe /SIL "hxxps://1fichier.com/" "%pa%\*.txt" 2^>NUL'
    ) Do @If "%%G" == ":" Echo(%%H)>"getdownload.txt"
© www.soinside.com 2019 - 2024. All rights reserved.