[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 急求助批处理批量提取指定文本内容

急求助批量提取

genteel禹品谑----iwuac97791----BDUSS=dlSkphREl0RGJqUkF5ZXhRT3hSSWFqaVEyNH5LNHhCTjVmUHExeXVta1VOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAADXDbPlZ2VudGVlbNPtxrfaygAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSqnFsUqpxbdk; STOKEN=4eb35f65a865b549934dcd0a9be983bec70296151d4fc9a52ac6836c13413938; SAVEUSERID=3939c963a2ea26bb34372691d46bf46e3dd7766d; PTOKEN=c8fdf062a5045f478536c3be8ebf1950; BAIDUID=16D27282730E4D7544C94DE97C92A269:FG=1
dutiful苍着湍----wykfy85372----BDUSS=WhlRlo0TTNnUnd-VWQ5M003b3RMQTZxenhROFBGTHBMYkt6bmo0UUZ6UVVOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAADUDbPlZHV0aWZ1bLLU18XNxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSqnFsUqpxbO; STOKEN=8d84c7f61a3d86d7c471aeaada23c8d00f005cd79ea2142019dc968a2a61352a; SAVEUSERID=233085de1b4d49fe5f63a56301f858d0c6fd415f; PTOKEN=1964a65734d6d7c57f63d63944d748c2; BAIDUID=08810ADAABA3C1041AA853E28352FFB2:FG=1
humorous郑方坟----zezil93399----BDUSS=FBT0o3QThyU3NIc0s0VENRTTdOYi1yVUdZSHFmMTNYVVJnMW0tUXpoRVJOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAACkDbPlaHVtb3JvdXPWo7e9t9gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGqnFsRqpxbb1; STOKEN=b73ebd98971506b4bff3a24ed1cad069ab2ec6fe8bcc67c27c66a2cddd7aceca; SAVEUSERID=f00d7e687e958d17aec66051eb81c08b4bea426df3; PTOKEN=2c05b7fc81c9af05d9e13634184ce2ac; BAIDUID=A1495454F4F0D8FD588B191CE481C3FE:FG=1
amiable濮哦搪----iahvf83066----BDUSS=dmMEVJcUxna2ZQU1A2STh0RHViLTJKNnd1OXdOOVhNUFVzSH5yZzk1RVBOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAAA01rLlYW1pYWJsZeWnxbbMwgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-qnFsPqpxbbH; STOKEN=83da437438e55aa9192723f831948890573da9155c278230db2f9d47e6f29454; SAVEUSERID=6d3565f72e65c92e6377b08a2e091dc098147f76; PTOKEN=6cffbdd8288c33470c1ef0932e3facf8; BAIDUID=A75E7FC0BC8351A5FECAB9E6CC9AF89D:FG=1
careful仇闻沮----hkdoa06317----BDUSS=Zva09BU1FCR2FaMFc3OTNNdTcweDJvUUt4SGU1Si1XRkhnTnBnUHQzSVFOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAAA91rLlY2FyZWZ1bLPwzsW-2gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCqnFsQqpxbMm; STOKEN=2aefc7531456a18949726c3449202a0383117fe6c0fd1c0f55c98de7722dac77; SAVEUSERID=f681428d3b189ac7a6ef6fd1498667ffab85ac56; PTOKEN=38744ef9b4ef50c72d7ccd590415a635; BAIDUID=0A96B7AED5F7CAAC45EAC808FCF1BAFA:FG=1




就提取这段前面的掐掉
BDUSS=Zva09BU1FCR2FaMFc3OTNNdTcweDJvUUt4SGU1Si1XRkhnTnBnUHQzSVFOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAAA91rLlY2FyZWZ1bLPwzsW-2gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCqnFsQqpxbMm; STOKEN=2aefc7531456a18949726c3449202a0383117fe6c0fd1c0f55c98de7722dac77; SAVEUSERID=f681428d3b189ac7a6ef6fd1498667ffab85ac56; PTOKEN=38744ef9b4ef50c72d7ccd590415a635; BAIDUID=0A96B7AED5F7CAAC45EAC808FCF1BAFA:FG=1

  1. @echo off
  2. for /f "skip=4 tokens=2* delims=-" %%a in (test.txt) do echo,%%b
  3. pause
复制代码

TOP

回复 2# qixiaobin0715


    处理完成自动保存吗?

TOP

处理了 需要让保存处理完的!

TOP

开个玩笑,你没说清楚。提取的文本有什么特征,如何保存?

TOP

BDUSS=dlSkphREl0RGJqUkF5ZXhRT3hSSWFqaVEyNH5LNHhCTjVmUHExeXVta1VOOFJiQVFBQUFBJCQAAAAAAAAAAAEAAADXDbPlZ2VudGVlbNPtxrfaygAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSqnFsUqpxbdk; STOKEN=4eb35f65a865b549934dcd0a9be983bec70296151d4fc9a52ac6836c13413938; SAVEUSERID=3939c963a2ea26bb34372691d46bf46e3dd7766d; PTOKEN=c8fdf062a5045f478536c3be8ebf1950; BAIDUID=16D27282730E4D7544C94DE97C92A269:FG=1



这段提取出来并保存成另外一个文本

TOP

是多个文件,还是一个文件?是最后一段吗?

TOP

2楼代码只局限于被处理的文本有5段,取第5段。你没说清楚,开个玩笑而已。

TOP

只取最后一个
  1. @if(0)==(0) echo off&setlocal enabledelayedexpansion
  2. @for /f "delims=" %%i in ('dir /b/a-d/on "*.txt"') do (
  3.     @for /f "delims=" %%j in ('type %%i^|cscript -nologo -e:jscript "%~f0"') do (
  4.     set str=%%j
  5.     )
  6. echo !str!>>%%~ni.log
  7. )
  8. pause & exit /b
  9. @end
  10. WSH.echo(WScript.StdIn.ReadAll().match(/BDUSS=[^\r\n]+/g).join('\r\n'))
复制代码
echo !str!>>%%~ni.log向上移动一行,取多行,%%~ni.log可以改为你想输出保存的文件名

TOP

返回列表