开发者

perl linux command not working

cat t.incopt.02.20110221 | awk -F, '{print $1}' | sort | uniq

got unque records

but if i inserted into perl,

@FETCH_REQ_DETAILS = `cat t.incopt.02.20110221 | awk -F\, '{print $1}' \| sort \| uniq开发者_C百科`;

if i print the above array vari, i getting entire file content, i guess the linux command not working correctly when i use inside perl,


I think you just need to enclose the command in back tick and escape only the $

@FETCH_REQ_DETAILS = `cat t.incopt.02.20110221 | awk -F, '{print \$1}' | sort | uniq;`


Try the following:

my $cmd='cat t.incopt.02.20110221 | awk -F, \'{print $1}\' | sort | uniq';

@FETCH_REQ_DETAILS = `$cmd`;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜