|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 46 楼』:
使用 LLM 解释/回答一下
按照change的思路,那么sed就可以这样改进一下了
sed ":nt; $!{N; s/\n//; tnt}; s/。/&\n\n/g" myfile.txt
According to the idea of change, then sed can be improved like this
sed ":nt; $!{N; s/\n//; tnt}; s/。/&\n\n/g" myfile.txt
|
|
2008-7-15 15:05 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 47 楼』:
使用 LLM 解释/回答一下
Originally posted by lxmxn at 2008-7-15 15:05:
按照change的思路,那么sed就可以这样改进一下了
sed ":nt; $!{N; s/\n//; tnt}; s/。/&\n\n/g" myfile.txt
是可以,但如果文件太大的话就不行了吧,模式空间能容纳太多内容吗?
Originally posted by lxmxn at 2008-7-15 15:05:
According to the idea of change, then sed can be improved like this
sed ":nt; $!{N; s/\n//; tnt}; s/。/&\n\n/g" myfile.txt
It is possible, but if the file is too large, it won't work, right? Can the pattern space hold too much content?
|

致精致简! |
|
2008-7-15 15:29 |
|
|
lxmxn
版主
       
积分 11386
发帖 4938
注册 2006-7-23
状态 离线
|
『第 48 楼』:
使用 LLM 解释/回答一下
Originally posted by 26933062 at 2008-7-15 15:29:
是可以,但如果文件太大的话就不行了吧,模式空间能容纳太多内容吗?
嗯,文件大了估计就不成了。
刚才试了一下,10K以下的文件处理起来还是比较快的,但是到了50K以上就比较慢了,过兆的文件就不适合了。
Originally posted by 26933062 at 2008-7-15 15:29:
It is possible, but if the file is too large, it won't work, right? Can the pattern space hold too much content?
Hmm, if the file is large, it probably won't work.
Just tried it. Files under 10K are processed relatively quickly, but above 50K, it's relatively slow, and files over a megabyte are not suitable.
|
|
2008-7-15 15:44 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 49 楼』:
使用 LLM 解释/回答一下
回45楼
这是我的执行结果
除了改动了测试文件路径
其它没有变
cd.>d\c.txt这句不是必须的
批处理文件(Batch File,简称 BAT文件)是 YYY 种在DOS
下最常用的可执行文件。它具有灵活的操纵性,可适应各
种复杂的计算机操作。所谓的批处理,就是按规定的顺序
自动执行若干个指定的DOS命令或程序。
即是把原来 YYY 个 YYY 个执行的命令汇总起来,成批的执行,而程序文件可
以移植到其它电脑中运行,因此可以大大节省命令反复输
入的繁琐。同时批处理文件还有一些编程的特点
。可以通过扩展参数来灵活的控制程序的执行,所以在日
常工作中非常实用。批处理。bat。cmd。尺有所短。寸有所长。
Reply to floor 45
This is my execution result. Except for changing the test file path, nothing else has changed. The line "cd.>d\c.txt" is not necessary.
Batch files (Batch File, referred to as BAT files) are a kind of most commonly used executable files under DOS. It has flexible operability and can adapt to various complex computer operations. The so-called batch processing means automatically executing several specified DOS commands or programs in a specified order.
That is, it is to collect the originally executed commands one by one and execute them in batches, and the program file can be ported to other computers for operation, so it can greatly save the tediousness of repeatedly entering commands. At the same time, batch files also have some programming characteristics. It can flexibly control the execution of the program through extended parameters, so it is very practical in daily work. Batch. bat. cmd. Each has its own strengths and weaknesses.
|
|
2008-7-16 08:20 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 50 楼』:
使用 LLM 解释/回答一下
Originally posted by qzwqzw at 2008-7-16 08:20:
回45楼
这是我的执行结果
除了改动了测试文件路径
其它没有变
cd.>d\c.txt这句不是必须的
总算试出来了,原来是n后面不能有那个斜杠。。
change f:\111\d\a.txt /nf:\111\d\c.txt /from "nnn" /to " yyy " /in not "。"
qzwqzw 兄,你那里可以有斜杠吗?
Originally posted by qzwqzw at 2008-7-16 08:20:
Reply to post 45
This is my execution result
Except for changing the test file path
Nothing else has changed
The sentence "cd.>d\c.txt" is not necessary
Finally figured it out, it turns out that there can't be that slash after n..
change f:\111\d\a.txt /nf:\111\d\c.txt /from "nnn" /to " yyy " /in not "。"
Brother qzwqzw, can you have a slash there?
|

致精致简! |
|
2008-7-16 10:25 |
|
|
qzwqzw
银牌会员
     天的白色影子
积分 2343
发帖 636
注册 2004-3-6
状态 离线
|
『第 51 楼』:
使用 LLM 解释/回答一下
看来你对相对路径和绝对路径缺乏足够的了解
前缀的\指代当前盘的根
很显然
因为你的数据文件不在当前盘
所以导致出错
It seems that you lack sufficient understanding of relative paths and absolute paths. The \ prefix refers to the root of the current drive. Obviously, because your data file is not on the current drive, it causes an error.
|
|
2008-7-16 13:27 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 52 楼』:
使用 LLM 解释/回答一下
是,对相对路径,一直是模模糊糊的。。。
原来如此。。!
Yes, I've always been a bit hazy about relative paths... So that's how it is!
|

致精致简! |
|
2008-7-16 14:16 |
|
|
yycmu4
初级用户
 
积分 20
发帖 9
注册 2008-9-10
状态 离线
|
|
2008-9-25 21:20 |
|
|
metoo
初级用户
 
积分 195
发帖 93
注册 2006-10-28
状态 离线
|
『第 54 楼』:
使用 LLM 解释/回答一下
其实awk处理这类问题很方便的。。只是很多人先入为主了
BEGIN {RS="。"}
{
gsub (/\n/,"")
print $0"。"}
老规矩,本人只用代码
Actually, awk is very convenient for handling such problems. It's just that many people have preconceived ideas.
BEGIN {RS="。"}
{
gsub (/\n/,"")
print $0"。"}
As usual, I only use code
|
|
2008-9-25 21:45 |
|
|
wuchan
初级用户
 
积分 119
发帖 59
注册 2008-11-21
状态 离线
|
『第 55 楼』:
使用 LLM 解释/回答一下
不知道 change 支持通配符不
I don't know if change supports wildcards
|
|
2010-1-2 10:45 |
|