求一个批处理命令。从txt中提取一段,另存为txt文件。
某文件夹下有多个含有类似以下内容的xxx.txt文件。把每个文件中的settings={……}内容提取出来,分别另存为DOS_xxx.txt文件。------------...
某文件夹下有多个含有类似以下内容的xxx.txt文件。把每个文件中的settings = {……}内容提取出来,分别另存为DOS_xxx.txt文件。
-----------------------------------------------------------------
s = {
id = "2A68E47A-453E-4660-856D-39D5339A52",
internalName = "New",
title = "Detail",
type = "Develop",
value = {
settings = {
AutoContrast = false,
AutoShadows = false,
Clarity = 75,
ColorNoiseReduction = 40,
Contrast = -20,
ConvertToGrayscale = false,
EnableDetail = true,
FillLight = 30,
HighlightRecovery = 60,
LuminanceSmoothing = 40,
ParametricDarks = -20,
ParametricHighlightSplit = 75,
ParametricHighlights = 70,
ParametricLights = -30,
ParametricMidtoneSplit = 50,
ParametricShadowSplit = 25,
ParametricShadows = 0,
Saturation = 10,
SharpenRadius = 0.5,
Sharpness = 50,
ToneCurve = {
0,
0,
32,
22,
64,
192,
},
ToneCurveName = "Medium Contrast",
Vibrance = 50,
},
uuid = "81CEB41-A68-42B-922-F34BFF010",
},
version = 0,
} 展开
-----------------------------------------------------------------
s = {
id = "2A68E47A-453E-4660-856D-39D5339A52",
internalName = "New",
title = "Detail",
type = "Develop",
value = {
settings = {
AutoContrast = false,
AutoShadows = false,
Clarity = 75,
ColorNoiseReduction = 40,
Contrast = -20,
ConvertToGrayscale = false,
EnableDetail = true,
FillLight = 30,
HighlightRecovery = 60,
LuminanceSmoothing = 40,
ParametricDarks = -20,
ParametricHighlightSplit = 75,
ParametricHighlights = 70,
ParametricLights = -30,
ParametricMidtoneSplit = 50,
ParametricShadowSplit = 25,
ParametricShadows = 0,
Saturation = 10,
SharpenRadius = 0.5,
Sharpness = 50,
ToneCurve = {
0,
0,
32,
22,
64,
192,
},
ToneCurveName = "Medium Contrast",
Vibrance = 50,
},
uuid = "81CEB41-A68-42B-922-F34BFF010",
},
version = 0,
} 展开
2个回答
展开全部
你的问题比较复杂,批处理做起来效率比较低,慢点慢点吧,你看看能凑合着用吗?
@echo off
setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('dir/b *.txt') do (
set j=0
echo 正在处理%%a,请稍等。。。
(for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%%a"') do (
echo %%j|findstr /c:"settings = {">nul&&set /a j=1
echo %%j|findstr {>nul&&set/a q+=!j!>nul
echo %%j|findstr }>nul&&set/a h+=!j!
if !j!==1 echo %%j
if !q!==!h! set j=0
))>DOS_%%a)
@echo off
setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('dir/b *.txt') do (
set j=0
echo 正在处理%%a,请稍等。。。
(for /f "tokens=1* delims=:" %%i in ('findstr /n .* "%%a"') do (
echo %%j|findstr /c:"settings = {">nul&&set /a j=1
echo %%j|findstr {>nul&&set/a q+=!j!>nul
echo %%j|findstr }>nul&&set/a h+=!j!
if !j!==1 echo %%j
if !q!==!h! set j=0
))>DOS_%%a)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询