-8

I have following code:

$eff=40;
$pos=34;

$line=exec("tail $i.dssp -n $eff | awk -F" " -v var=$pos '{if ($2==var) print FNR}'");

Please help...

6
  • What are you trying to solve? What is going wrong? Commented May 19, 2014 at 0:50
  • 1
    you need to escape the double quotes after -F\ Commented May 19, 2014 at 0:51
  • @shuttle87, You will have to look at his previous question to understand the context for this one. Commented May 19, 2014 at 1:07
  • @merlin2011, A link to the previous question would have been an extremely good thing to include in the question because I Was not aware of that context Commented May 19, 2014 at 2:03
  • 1
    @shuttle87, I could not agree more. That's why I put in a link in my answer to make it more clear to future readers. Commented May 19, 2014 at 2:04

1 Answer 1

1

As I said in my answer to your previous question, you can fix this easily by using single quotes on the inside.

PHP Code

<?php
$eff=40;
$pos=34;
$i = 'hello';
$line=exec("tail $i.dssp -n $eff | awk -F' ' -v var=$pos '{if ($2==var) print FNR}'");
print "$line\n";
?>

Sample Input (hello.dssp):

foobar 34

Sample Output:

1
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.