- 論壇徽章:
- 0
|
有這樣一條去重復(fù)行的命令,我在命令行輸入,無報(bào)錯且結(jié)果正確,
perl -n -e 'if (/^\s*$/){print;next};if (exists($hash{$_})) {next} else {$hash{$_}=1;print}' /tmp/digdig/apache/tosfstat1tmp > /tmp/digdig/apache/11111.txt
可是當(dāng)我要把它放在perl里面的時(shí)候,
#!/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
會報(bào)錯如下:
-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$
不知這是要設(shè)置什么嘛
多謝~~ |
|