Deepak
Deepak

Reputation: 414

Unable to execute awk command in PHP script

<?php
$dd="lastDateTemplate-28-11-2013.csv";
$c_row=exec("awk 'BEGIN { FS = "," } ; { print $1 }'" .$dd);
?>

I am not able to execute AWK command in PHP.

Below is the error -:

PHP Parse error: syntax error, unexpected '='

Upvotes: 0

Views: 1188

Answers (1)

Bhadra
Bhadra

Reputation: 2104

$c_row=exec("awk 'BEGIN { FS = \",\" } ; { print $1 }'" .$dd,$output);

all the output lines printed will be captured in $output ,that is passed as the argument.

you can access output from the $output

exec

Upvotes: 2

Related Questions