求文本字符串替换 bat
uint8_T——>u8int8_T——>s8uint16_T——>u16int16_T——>s16uint32_T——>u32int32_T——>s32real32_T...
uint8_T ——> u8
int8_T ——> s8
uint16_T ——> u16
int16_T ——> s16
uint32_T ——> u32
int32_T ——> s32
real32_T ——> float
real64_T ——>double
要按这顺序替换 展开
int8_T ——> s8
uint16_T ——> u16
int16_T ——> s16
uint32_T ——> u32
int32_T ——> s32
real32_T ——> float
real64_T ——>double
要按这顺序替换 展开
1个回答
展开全部
@echo off&setlocal enabledelayedexpansion
(for /f "delims=" %%a in (test.txt) do (
set "line=%%a"
set "line=!line:uint8_T=u8!"
set "line=!line:int8_T=s8!"
set "line=!line:uint16_T=u16!"
set "line=!line:int16_T=s16!"
set "line=!line:uint32_T=u32!"
set "line=!line:int32_T=s32!"
set "line=!line:real32_T=float!"
set "line=!line:real64_T=doble!"
))>$
move $ test.txt
追问
不行啊,里面的uint8_T这些是没掉了,不是改掉了
追答
@echo off&setlocal enabledelayedexpansion
(for /f "delims=" %%a in (test.txt) do (
set "line=%%a"
set "line=!line:uint8_T=u8!"
set "line=!line:int8_T=s8!"
set "line=!line:uint16_T=u16!"
set "line=!line:int16_T=s16!"
set "line=!line:uint32_T=u32!"
set "line=!line:int32_T=s32!"
set "line=!line:real32_T=float!"
set "line=!line:real64_T=doble!"
echo.!line!
))>$
move $ test.txt
少写了一句!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询