不明白 vs BLOG


当从不明白走向明白,你会知道什么是艰辛;当从不明白成为明白,你会知道,这一切都很值得!

  VC知识库BLOG :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 登录 ::
  14 随笔 :: 6 文章 :: 113 评论 :: 0 Trackbacks
<2010年1月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

收藏夹

好友blog链接

技术网址链接

自动化测试

资源站点

搜索

最新评论

阅读排行榜

评论排行榜

对文件的每一行字符串进行排序并输出到另一个文件,perl源码如下:
#!/usr/bin/perl -w
open(MYFILE,"myfile.txt")||die "Can't open the file: myfile.txt.";
open(NEWFILE,">new.txt")||die "Can't open the file: newfile.txt.";
while(<MYFILE>)
{
$line=<MYFILE>;
#chomp $line;
@output=(@output,$line);
}
#foreach $item (@output)
{
print NEWFILE sort{$a cmp $b;}@output;
}
close(NEWFILE);
close(MYFILE);

By cursorkey, please reserve all words in the note when you want to copy!
posted on 2005-03-07 17:30 不明白 阅读(4253) 评论(5)  编辑 收藏

评论

# re: 文件按行排序 2005-03-07 19:23 yao
cmd中有命令:
sort < myfile.txt >new.txt

# re: 文件按行排序 2005-03-08 10:23 不明白
对不起,初学perl,不太明白你说的,你是说perl中有这个命令吗?估计那是后面的内容,我才刚学到简单文件操作。非常感谢关注,希望以后能给予更多指教!谢谢!

# re: 文件按行排序 2010-01-01 11:17 PTFE, Teflon
顶!! blog.vckbase.com

# re: 文件按行排序 2010-01-11 21:05 teflon
<a href="http://www.autai.com">ptfe teflon china</a>
<a href="http://www.autai.com/ptfeteflon.htm">ptfe teflon</a>
<a href="http://www.autai.com/PTFEROD-TEFLONROD.htm">ptfe teflon rod</a>
<a href="http://www.autai.com/PTFESHEET-TEFLONSHEET.htm">ptfe teflon sheet</a>
<a href="http://www.autai.com/PTFETUBING-TEFLONTUBING.htm">ptfe teflon tubing</a>
<a href="http://www.autai.com/PTFESEAL-TEFLONSEAL.htm">ptfe teflon seal</a>

# re: 文件按行排序 2010-01-11 21:05 teflon
[url]http://www.autai.com[/url]

标题  
姓名  
主页
验证码 *
内容   
  登录  使用高级评论  Top
[使用Ctrl+Enter键可以直接提交]