In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use batch processing to remove all zeros before specified characters. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
For example, text 1.txt:
Code:
0000acb0h
0b0c00a000s
0000h00ga00
A0000000
The zero before the an of all string characters in the text is removed by batch processing, and the output is as follows:
Code:
Acb0h
Bca000s
Hga00
A0000000
Requirements: the code is simple, efficient, universal, and no temporary files are generated.
Pusofalse:
The code is as follows:
@ echo off
For / f "delims="%. In (1.txt) do (
Set "str=%%."
Call,set "str=%%str:*a=%%"
For / f "delims=a"% {in ("%.") Do (
Set "var=%% {"
Call,echo.%%var:0=%%a%%str%%
))
Pause > nul
Batman:
The code is as follows:
@ echo off
For / f "tokens=1,2 delims=a"% I in (1.txt) do (
If "j" neq "" (
Set "str=%%i"
Call,set "str=%%str:0=%%"
Call,echo str%%a%%j
) else (
Echo a%% I
)
)
Pause > nul
The reason why batch processing is so popular is that it is convenient to write and use.
At the same time, from another level, we are required to deal with specific problems. I believe no one will.
Write a code suitable for all such problems in order to solve a common problem.
Well, if you really want to do so, the loss of time will be an inestimable loss, I
And the loss will outweigh the gain.
This is the end of this article on "how to use batch processing to remove all zeros before specified characters". I hope the above content can be helpful to you, so that you can learn more knowledge. If you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.