Discussion Locked

Awk in perl

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

$awksmd = "/bin/awk";
$datecmd = "/bin/date";
$temp = `$datecmd | $awkcmd '{print $5}'`;
print "$temp";

Does anyone know why the following perl code does not work. When I ran the perl script above it does not seem like awk is invoked.

1 reply

by dbeethe

I had the same type of problem...
Turned out it was because the $5 was being interpreted... Add \ (awkcmd '{print \$5}'"; and it will work... or at least it did for me.

This discussion is closed to new replies.