中国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 07:26
48,039 topics / 350,124 posts / today 2 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Help] An advanced question: replacing text strings
Printable Version  1,685 / 20
Floor1 leo1984 Posted 2007-10-31 13:00
初级用户 Posts 43 Credits 96
Floor2 abcd Posted 2007-10-31 13:26
银牌会员 Posts 739 Credits 1,436
Floor3 leo1984 Posted 2007-10-31 13:31
初级用户 Posts 43 Credits 96
Sorry, brother,
what kind of command is this sed thing at the beginning?
I'm a Windows XP user, other than batch files I can understand,
how exactly do I run the command you provided?
Thanks
Floor4 abcd Posted 2007-10-31 13:32
银牌会员 Posts 739 Credits 1,436
sed is a third-party tool, a Unix tool, but there is a DOS version of it.

You can search the forum.
Floor5 leo1984 Posted 2007-10-31 13:41
初级用户 Posts 43 Credits 96
Please tell me, I found these two versions here, and I also want to learn the language for this set of tools.
http://tw.myblog.yahoo.com/c9993/article?mid=37&prev=73&next=20


Extracted path UnxUtils\usr\local\wbin

Extracted path UnxUpdates

What is the difference between these two?
And is it also like CGI or PHP environment variables?
Floor6 abcd Posted 2007-10-31 13:45
银牌会员 Posts 739 Credits 1,436
Originally posted by leo1984 at 2007-10-31 01:41 PM:
Please tell me, I found these two versions here, and I also want to learn the language for this set of tools.
http://tw.myblog.yahoo.com/c9993/article?mid=37&prev=73&next=20


Extracted path UnxUtils\usr\l ...


Try this one, just put it under system32.
There are also some posts in the forum about simple sed usage.

Attachments
sed.rar (40.33 KiB)
Floor7 leo1984 Posted 2007-10-31 14:09
初级用户 Posts 43 Credits 96
Interesting tool.
Quite a few very handy commands.
Thanks for the guidance, brother ^^
Floor8 leo1984 Posted 2007-10-31 14:12
初级用户 Posts 43 Credits 96
I forgot to ask, brother,
I have a lot of text files to process.
The command you gave can only process one file at a time.
How do I process the text files in the whole directory and then output them?
Thanks
Floor9 abcd Posted 2007-10-31 14:15
银牌会员 Posts 739 Credits 1,436
Use a for %%i in (.cgi)
Floor10 leo1984 Posted 2007-10-31 14:19
初级用户 Posts 43 Credits 96
Write it like this? @@
Doesn't seem to work.

@echo off
md Temp
for /f "delims=" %%f in ('dir /on/b "*.txt"') do (
echo.>Temp\%%~nf.txt
sed "s#^\(*\)∥\(*\)\(.*\)#\2∥\1\3#" %%i in (%%f) do sed %%i∥%%j∥%%k∥%%l∥%%m∥%%n∥%%o∥>>Temp\%%~nf.txt
)
pause

[ Last edited by leo1984 on 2007-10-31 at 02:20 PM ]
Floor11 abcd Posted 2007-10-31 14:25
银牌会员 Posts 739 Credits 1,436
Figure it out yourself, I didn't say it should be written like this
Floor12 leo1984 Posted 2007-10-31 15:07
初级用户 Posts 43 Credits 96
Sorry to trouble you, brother.
I've been studying it for quite a while, and what I wrote still can't succeed smoothly.
Please first guide this newbie on how to write it.
Help me get my website text processed first, many thanks ><
Floor13 abcd Posted 2007-10-31 15:13
银牌会员 Posts 739 Credits 1,436


Modified based on what the OP posted.

Haven't tested it.
pause
Floor14 zh159 Posted 2007-10-31 16:01
金牌会员 Posts 1,467 Credits 3,687
The one I gave you before would work already, just swap %%i and %%j

Floor15 leo1984 Posted 2007-10-31 18:49
初级用户 Posts 43 Credits 96
The brothers above are all really enthusiastic, the test works fine now.
I also do Chinese localization and cracking software myself.
Being able to learn together with you brothers is really great.
Once the website is fixed, I'll come exchange and learn with all of you experts too ^^
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023