- 论坛徽章:
- 0
|
有这样一条去重复行的命令,我在命令行输入,无报错且结果正确,
perl -n -e 'if (/^\s*$/){print;next};if (exists($hash{$_})) {next} else {$hash{$_}=1;print}' /tmp/digdig/apache/tosfstat1tmp > /tmp/digdig/apache/11111.txt
可是当我要把它放在perl里面的时候,
#!/usr/bin/perl
use strict;
use Time::Local;
use warnings;
perl -n -e 'if (/^\s*$/){print;next};if (exists($hash{$_})) {next} else {$hash{$_}=1;print}' /tmp/digdig/apache/tosfstat1tmp > /tmp/digdig/apache/11111.txt
会报错如下:
-bash-4.1$ ./del_conflict.pl
Bareword found where operator expected at ./del_conflict.pl line 28, near "11111.txt"
(Missing operator before txt?)
syntax error at ./del_conflict.pl line 28, near "n -e "
Execution of ./del_conflict.pl aborted due to compilation errors.
-bash-4.1$
不知这是要设置什么嘛
多谢~~ |
|