i want common data present in file1 , file2.
<?php $cmd="comm -12 <(sort /source/20-07-2015/file1 | uniq) <(sort /source/20-07-2015/file2 | uniq) > /20-07-2015/commondata_20072015-248932-ac.csv"; $result =exec($cmd); ?> but above code throwing error:
sh: -c: line 0: syntax error near unexpected token `('
php exec() uses sh , sh not support <(...).
the simplest fix (from knows sh/bash not php) have sh invoke bash run command:
$cmd="bash -c 'comm -12 <(sort /source/20-07-2015/file1 | uniq) <(sort /source/20-07-2015/file2 | uniq) > /20-07-2015/commondata_20072015-248932-ac.csv'";
Comments
Post a Comment