中国DOS联盟论坛

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-08-06 08:34
48,039 topics / 350,124 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Help] A very urgent text deletion problem, I'm about to cry ><
Printable Version  711 / 8
Floor1 leo1984 Posted 2007-10-31 02:01
初级用户 Posts 43 Credits 96
Hello everyone, I help manage a forum I set up for a friend.
This forum uses a CGI program, so the forum's data is all in text files.
But some problems came up while editing the text files, please help me ><


The text files use as the separator.

I want to find in all text files and delete everything between the last, second-to-last, and third-to-last ∥ separators.
Example as follows:

Before processing:


1∥PowerDirector 6 practical online tutorial∥Who am I∥123@yahoo.com.tw∥This webpage cannot be linked<br>∥2007/10/11 10:55∥219.84.136.241d6wRPnMHgj46Q1192071350QBIFBW3Q

After processing:

1∥PowerDirector 6 practical online tutorial∥Who am I∥123@yahoo.com.tw∥This webpage cannot be linked<br>∥2007/10/11 10:55∥219.84.136.241∥

Simply put, as long as everything after 219.84.136.241 can be deleted, that's fine.
But 219.84.136.241 is the user's IP, so it is an irregular string.


Please help, thank you very, very, very much, it's urgent ><
Many thanks

[ Last edited by leo1984 on 2007-10-31 at 02:03 AM ]
Floor2 zh159 Posted 2007-10-31 02:32
金牌会员 Posts 1,467 Credits 3,687
Floor3 leo1984 Posted 2007-10-31 02:48
初级用户 Posts 43 Credits 96
Thank you very much for your kind help.
But if I change Oldlist.txt to *.txt, that means opening all text files.
Then how can I save the modified text files directly themselves, without outputting Newlist.txt
instead?

[ Last edited by leo1984 on 2007-10-31 at 02:49 AM ]
Floor4 zh159 Posted 2007-10-31 09:06
金牌会员 Posts 1,467 Credits 3,687
In batch files you can't directly read from and save to the same text file at the same time, otherwise the new data will directly overwrite the old data.

Test it yourself first.


[ Last edited by zh159 on 2007-10-31 at 09:08 AM ]
Floor5 abcd Posted 2007-10-31 09:23
银牌会员 Posts 739 Credits 1,436
Floor6 leo1984 Posted 2007-10-31 09:42
初级用户 Posts 43 Credits 96
Thank you very much for your help, zh159, it has already been solved successfully.
I also wish you all the best ^^

Also thanks to abcd, but I tested that section too, and it seems it only searched for the string and didn't really do anything. Thanks to you as well ^^
Floor7 xinhepc Posted 2007-10-31 11:10
初级用户 Posts 40 Credits 90 From 广州
Why is the OP's text in Traditional Chinese? It feels so awkward to read!
Floor8 leo1984 Posted 2007-10-31 12:53
初级用户 Posts 43 Credits 96
Sorry,
because I'm a user from Taiwan, I can only type in Traditional Chinese ^^"
Floor9 zh159 Posted 2007-10-31 15:52
金牌会员 Posts 1,467 Credits 3,687
Not just Taiwan, Hong Kong uses Traditional Chinese too (I'm from the mainland ^_^)

Simplified Chinese is convenient for writing, but Traditional Chinese may show more skill in calligraphy; Simplified should be promoted, but Traditional must not be forgotten ^_^
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023