
MS-DOS에서 파일의 각 줄 앞에 문자열을 어떻게 추가합니까?
그리고 타사 명령이 없으므로 AWK와 같은 것은 없습니다(일부는 MSDOS에서 실행되는 것으로 알고 있습니다).
저는 CMD(NT4 이후 XP 또는 Win10과 같은 WinNT 기반 OS의 cmd 콘솔)에 for 명령에 대한 많은 옵션이 있다는 것을 알고 있습니다. https://www.robvanderwoude.com/ntfor.php 하지만 MS-DOS에는 CMD가 수행하는 멋진 FOR 명령이 없습니다.
보다https://web.archive.org/web/20100325172740/http://vfrazee.com/ms-dos/6.22/help/ 그리고 https://web.archive.org/web/20100521101405/http://www.vfrazee.com/ms-dos/6.22/help/for.htm
그렇다면 MS-DOS에서는 어떻게 하시겠습니까?
그리고 QBASIC이 없으면
답변1
"명령 프롬프트에서 반송"이라는 방법입니다.
MS-DOS 작성자가 상상하지 못했던 혁신적인 방법입니다.
CMD에서도 작동합니다
유즈넷과 뉴스 그룹 시대에 언급되었습니다.
C:\rara>dir /b
file.txt
C:\rara>type file.txt
house
fish
dog
C:\rara>ren file.txt file.bat
C:\rara>prompt the
thefile >file2
'house' is not recognized as an internal or external command,
operable program or batch file.
'fish' is not recognized as an internal or external command,
operable program or batch file.
'dog' is not recognized as an internal or external command,
operable program or batch file.
theprompt $p$g
C:\rara>type file2
thehouse
thefish
thedog
C:\rara>