system (“ sed...")求助

system (“ sed...")求助

#目的:将tc文件的一行内容加入到dump1文件的""中间,最后输出到dump文件
...
open (TCIN,'tc') or die("cannot open file!";
open (TDIN,'td') or die("cannot open file!";

while (my $TDline =<TDIN>
{
        my $TCline = <TCIN>;
        system("sed \"s/\"\"/\"$TCline\"/\" dump1 >dump";
        ...
}
报错如下:
sed:-e 表达式 #1,字符 6:unterminated 's' command
sh: line 1: /: is a directory
sh: -c: line 0: unexpected EOF while looking for matching  '''
sh: -c: line 2: syntax error: unexpected end of file
请问各位大侠如何解决以上错误呢?
不胜感激.
都已经使用了perl,还需要再用system来调用sed么?
我不知道perl怎么样实现这么一个功能?


QUOTE:
原帖由 paminy 于 2008-10-3 21:48 发表
#目的:将tc文件的一行内容加入到dump1文件的""中间,最后输出到dump文件
...
open (TCIN,'tc') or die("cannot open file!";
open (TDIN,'td') or die("cannot open file!";

while (my $TDline =)
...



[Copy to clipboard] [ - ]
CODE:
open (TCIN,'tc') or die("cannot open file:$!");
open (TDIN,'td') or die("cannot open file:$!");
open (DUMP1,'dump1') or die("cannot open file:$!");
open (DUMP,'>dump') or die("cannot open file:$!");

while (my $TDline =<TDIN>)
{
        my $TCline = <TCIN>;
        while ( <DUMP1> )
        {
                s/""/"$TCline"/;
                print DUMP "$_\n";
        }
}

谢谢ly5066113    (Tim)