![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-26 03:37 |
47,813 topics / 349,918 posts / today 0 new / 48,275 members |
| DOS批处理 & 脚本技术(批处理室) » Question: Organize the text (newcomers and veterans are all welcome to try) |
| Printable Version 7,126 / 54 |
| Floor31 HAT | Posted 2008-07-14 16:27 |
| 版主 Posts 5,017 Credits 9,023 | |
|
```
change a.txt /from "&H0D0A" /to null change a.txt /from "。" /to "。&H0D0A0D0A" ``` change.exe http://upload.cn-dos.net/img/427.zip [ Last edited by HAT on 2008-10-29 at 14:19 ] |
|
| Floor32 26933062 | Posted 2008-07-14 17:21 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
The idea of building block 31 is also to concatenate a.txt into one line first and then replace. The test is still not working. I just downloaded a change and tried it.
Ask a question: How to represent lines that do not include a certain character in change? |
|
| Floor33 qzwqzw | Posted 2008-07-14 17:34 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
It seems there's no problem. How come it doesn't work?
change is not sed There aren't so many regular expression markers As for the lines that don't contain the specified character There is a /v switch Similar to find [ Last edited by qzwqzw on 2008-7-14 at 05:41 PM ] |
|
| Floor34 qzwqzw | Posted 2008-07-14 17:39 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Oh, I see.
Didn't you notice that change is a program for DOS? To run it under the win32 console cmd, you need to initialize the Chinese environment first. chcp 437>nul & graftabl 936>nul |
|
| Floor35 26933062 | Posted 2008-07-14 17:44 |
| 银牌会员 Posts 879 Credits 2,268 | |
Originally posted by qzwqzw at 2008-7-14 17:39: It is indeed this problem, thank you! But I still want to ask, how to represent the lines that do not include a certain character in change? My idea is to first replace all periods with carriage returns, and then delete the carriage returns of all lines that do not contain periods |
|
| Floor36 26933062 | Posted 2008-07-14 17:59 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Is there a tutorial for change.exe? The help information is in English and I can't understand any of it...
|
|
| Floor37 HAT | Posted 2008-07-14 18:04 |
| 版主 Posts 5,017 Credits 9,023 | |
|
I have a part of Chinese help, incomplete.
CHANGE.EXE is a command-line tool for processing file modifications. The target file can be of any size and any format. It can execute 30 commands at a time! Very efficient. |
|
| Floor38 HAT | Posted 2008-07-14 18:05 |
| 版主 Posts 5,017 Credits 9,023 | |
|
//But I still want to ask, how to represent the lines that do not include a certain character in change?
/V says to find those items that do NOT match the specification; |
|
| Floor39 26933062 | Posted 2008-07-14 18:14 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Thanks, the Chinese help information I got is also like this, too little.
My original intention was to replace the carriage return of the line containing the full stop with yyy plus carriage return, but why did the lines without full stops also add yyy at the end??? |
|
| Floor40 qzwqzw | Posted 2008-07-14 19:10 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Indeed, that's the problem. Thanks!
But I still want to ask, how to represent lines that do not include a certain character in change? My idea is to first replace all periods with carriage returns, and then delete the carriage returns of all lines that do not contain periods. -------------------- Really very meticulous Since there is already a suitable solution Why go for the difficult instead of the easy? Change has two working modes One is binary (block) mode That is, the full-text replacement I mentioned Read bytes in blocks and then perform replacement Treat 0d0a as ordinary bytes The other is text (record) mode That is, the line buffering mode I mentioned Read text by line and then perform replacement Special processing will be done for 0d0a And if &H hexadecimal characters are used in /from /to /in Then it directly enters binary mode And the /in switch requires the support of text mode So your replacement operation is invalid The following command is an example change \test\a.txt /n\test\b.txt /from "文件" /to "file" /in not "File" |
|
| Floor41 26933062 | Posted 2008-07-14 19:17 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Thanks, thanks a lot, got quite a few gains again... ^_^
|
|
| Floor42 HAT | Posted 2008-07-14 19:34 |
| 版主 Posts 5,017 Credits 9,023 | |
|
The explanation of qzwqzw is really detailed ah ^_^
|
|
| Floor43 26933062 | Posted 2008-07-14 23:25 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
It's really frustrating. Why can't I run brother qzwqzw's sample code?
My test code is as follows: xp sp2 : The understanding of this code is: Run in test mode, that is, read line by line. No temporary file is generated, the new file is in c.txt, Replace "一" with " yyy " in the lines that do not contain full stops |
|
| Floor44 qzwqzw | Posted 2008-07-15 00:16 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Oh!
test is the relative path of my own sample text file not a pattern Do not put spaces after /n |
|
| Floor45 26933062 | Posted 2008-07-15 13:34 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
It seems it's determined to bully me. I've tested like this too, still no good
[ Last edited by 26933062 on 2008-7-15 at 01:35 PM ] |
|
| Prev 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |