Or, finally, with
Perl:
Code:
if ($line =~ m/'(\d+)\)/) { $Var1=$1 }
The reason you were getting syntax errors is that backticks in
Perl will undergo what the documentation calls "double-quotish" expansion. Basically, this means that if you want a backslash to be passed to the shell, you will need to double it, because
Perl already parses one level of backslashes. Also, the value of
$line is being interpolated by
Perl, so the shell sees the literal value
echo USING (FILE '/TEST1/FILENAME'5000) without any quoting, and complains about the opening parenthesis. You can get around this with proper quoting; but of course, for trivial string manipulations,
Perl itself is actually much better suited than the shell.