The problem you are suffering from is that fact that the backticks are an interpolative context. Which means that the $1 you have is interpolated before the call to awk is made. And you have the same for the $0. Putting backslashes before the dollar signs will solve this problem.
However, it doesn't make sense to use backticks here. Backticks run the command, and return the output of the command - however, since your command redirects all output, there's nothing to collect. The following system command you make doesn't make sense - it executes nothing. You'd be better off to use system here, instead of the backticks - and then you can q and avoid $1 and $0 to be interpolated:
system q {awk '$1 ~ /^F/ {print $0 }' /tmp/frhtest/ADDC.bak > /tmp/frh
+test/ADDC.}.$date;
die "Command failed" if $?;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|