일괄 처리 텍스트 내용 가운데 표시 코드
코드:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
CMD 원래 창에서는 윈도우 크기를 조절하지 않고 임시 파일을 생성하지 않으며 텍스트 내용을 가운데에 표시해야 합니다.출력은 다음과 같습니다.
코드:
[Promise don't come easy]
I should have known all along.
There was something wrong.
I just never read between the lines.
Then I woke up one day and found you on your way.
Leaving nothing but my heart behind.
What can I do to make it up to you.
Promises don't come easy.
But tell me if there's a way to bring you back home to stay.
Well I'd promises anything to you.
I've been walkin' around with my head hanging down.
Wondrin' what I'm gonna do.
'Cause when you walked out that door.
Batcher:
sed -e :a -e "s/^.\{1,77\}$/&/;ta"a.txt
sed.exe
http://xiazai.jb51.net/201010/tools/sed_jb51.rar
batman: 아이디어 설명:
다음 코드는 충분한findstr 명령의 예입니다.findstr/n을 사용하여 줄 번호를 얻어 빈 줄을 호환합니다.
줄 번호를 변수에 값을 부여하기;findstr/o를 사용하여 줄의 문자 편이량을 얻지만,
위쪽, 아래쪽의 문자 편차
두 문자의 편향이 있기 때문에 마지막 줄에 강제로 차를 돌려보내서 원문서를 파괴하지 않는 것을 피할 수 없다
상황에서 임시 파일을 생성할 수밖에 없다.findstr/o를 이용하여 텍스트의 모든 줄의 문자 편향을 한꺼번에 얻을 수 있습니다
이량, 즉 문자 총수인데 효율은 문자별로 판단하는 것보다 훨씬 높을 것이다.
---------------------------------
@echo off
copy /y 1.txt 2.txt>nul
echo.>>2.txt&echo end>>2.txt
for /f "tokens=1,2* delims=: " %%i in ('findstr /n /o .* 2.txt') do (
set "_%%i=%%j"&set ".%%i=%%k"
if %%i geq 2 call :lp %%i
)
del /q 2.txt&pause>nul&goto :eof
:lp
set /a n=%1-1
set /a num=_%1-_%n%-2
set /a kl=(80-num)/2
for /l %%i in (1,1,%kl%) do set /p= call,set /p=%%.%n%%%
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.