Jump to content

AWK in PHP :


geevim

Recommended Posts

Hi,

 

The following script doesn't work, when i try to pipe the output from awk.

It works fine if i don't pipe the output..But In that case I am not able to pass the output to

variable...

 

I dont' know where I am going wrong..

Can someone help me asap plzzzzzzzzzzz..... :'(

 

$descfile = "user.oddescriptors.txt";
$handle = fopen("$descfile", "r+");
if($handle==false)
die("unable to create file");
if (file_exists("$descfile")) {
echo "$descfile";
//$out1 = exec("awk 'FNR>186' $descfile");
//echo "$out1";
//$out2 = exec("awk '{sub(/^/, "1, ")};1' $out1");
////echo "$out2";


$output = exec("awk 'FNR>186' "$descfile" |awk '{sub(/^/, "1, ")};1'|awk '{sub(/[ \,?]+$/, "")};1'|awk '{$116=$117=$118=$126=""}1'");
echo "$output";

}

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/205717-awk-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.