从 shell 命令中删除白色间距
Remove white spacings from shell command
我正在开发一个 shell 脚本来执行一个 returns 校验和字符串的命令。这个字符串的每个六边形都用空格分隔,我想删除一些东西,例如,4AA512,而不是 4A A5 12 作为命令输出,但我找不到有效的解决方案。这里的脚本:
for /f "delims=" %%f in ('dir %~dp0*.zip /b') do (
echo %%~f:
for /f "delims=" %%a in ('certUtil -hashfile "%~dp0%%~f" SHA512 ^| find /i /v "SHA512" ^| find /i /v "certUtil"^') do (
echo %%a:' '=''%
)
set /a counter += 1
echo.
)
有人有解决办法吗?
谢谢!
(答案从 question/comment 移至 - 嗯 - 一个答案)
终于找到解决办法了:
set counter=0
for /f "delims=" %%f in ('dir %~dp0*.zip /b') do (
echo %%~f:
for /f "delims=" %%a in ('certUtil -hashfile "%~dp0%%~f" SHA512 ^| find /i /v "SHA512" ^| find /i /v "certUtil"^') do (call :ShowChecksum "%%a")
set /a counter += 1
echo.
)
echo %counter% files(s) found.
pause
exit
:ShowChecksum
set "checksum=%~1"
set "checksum=%checksum: =%"
echo %checksum%
我正在开发一个 shell 脚本来执行一个 returns 校验和字符串的命令。这个字符串的每个六边形都用空格分隔,我想删除一些东西,例如,4AA512,而不是 4A A5 12 作为命令输出,但我找不到有效的解决方案。这里的脚本:
for /f "delims=" %%f in ('dir %~dp0*.zip /b') do (
echo %%~f:
for /f "delims=" %%a in ('certUtil -hashfile "%~dp0%%~f" SHA512 ^| find /i /v "SHA512" ^| find /i /v "certUtil"^') do (
echo %%a:' '=''%
)
set /a counter += 1
echo.
)
有人有解决办法吗?
谢谢!
(答案从 question/comment 移至 - 嗯 - 一个答案)
终于找到解决办法了:
set counter=0
for /f "delims=" %%f in ('dir %~dp0*.zip /b') do (
echo %%~f:
for /f "delims=" %%a in ('certUtil -hashfile "%~dp0%%~f" SHA512 ^| find /i /v "SHA512" ^| find /i /v "certUtil"^') do (call :ShowChecksum "%%a")
set /a counter += 1
echo.
)
echo %counter% files(s) found.
pause
exit
:ShowChecksum
set "checksum=%~1"
set "checksum=%checksum: =%"
echo %checksum%