![]() |
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 10:30 |
48,039 topics / 350,124 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » [Help] How do I process strings within a specific delimiter? |
| Printable Version 778 / 6 |
| Floor1 leo1984 | Posted 2007-11-05 11:51 |
| 初级用户 Posts 43 Credits 96 | |
|
I have a text whose contents are like this:
∥bc915∥∥∥Ediary 2.53∥59.117.162.144∥2007/08/23/ 01:10:07∥2007/08/23/ 01:10:07∥698∥4∥2007/10/12 13:13∥∥∥∥TATATA∥ The red parts are the parts I want to delete. And I want to replace the blank parts with "China forever" And I need to modify only the strings within that delimiter, and not modify anything else But after writing this much I don't know how to continue @echo off Could I trouble the experts to help me write an example I'll modify it according to my needs Many thanks ><" [ Last edited by leo1984 on 2007-11-5 at 11:53 AM |
|
| Floor2 junchen2 | Posted 2007-11-05 12:42 |
| 高级用户 Posts 219 Credits 537 From 杭州--半山 | |
| Floor3 terse | Posted 2007-11-05 12:43 |
| 银牌会员 Posts 946 Credits 2,404 | |
| Floor4 leo1984 | Posted 2007-11-05 18:16 |
| 初级用户 Posts 43 Credits 96 | |
|
Many thanks to the experts for helping
But I want to modify only the string inside %%p, and nothing else should be modified But I just tried it, and it seems nothing got modified @@? What is the reason? |
|
| Floor5 abcd | Posted 2007-11-05 18:44 |
| 银牌会员 Posts 739 Credits 1,436 | |
|
sed "/∥/ s# #中國萬歲#4;s#/##7;s###7;s#:##5" 1.txt>2.txt
If you can use sed, why not use it?? [ Last edited by abcd on 2007-11-5 at 08:54 PM |
|
| Floor6 terse | Posted 2007-11-05 19:44 |
| 银牌会员 Posts 946 Credits 2,404 | |
| Floor7 leo1984 | Posted 2007-11-05 21:33 |
| 初级用户 Posts 43 Credits 96 | |
|
Many thanks to expert terse for the guidance ^^
One day my teacher, a father for life @@ For expert abcd, it's not that I won't use it @@ It's because I want something I can "understand" and "learn" Right now I only just know how to read DOS commands and have just started learning to write them I'm learning bit by bit Using sed can work successfully, but I haven't learned that part yet ^^ Many thanks for your guidance, and for understanding a beginner |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |