Please use ***
[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do
not use quote tags, bolding, colors, "start/end" lines, or other creative techniques. Thanks.
A better technique is to import the shell variable into an
awk variable.
And you don't need to export a variable unless some sub-process needs to access it in their own environment. Exporting is only rarely needed in shell scripts.
Also,
$(..) is highly recommended over `..`
Code:
FLINE=1
FILE_NAME="$( awk -v "lnum=$FLINE" 'NR==lnum' my_file.f )"
echo "$FILE_NAME"
But finally,
sed is usually easier to use than
awk when extracting specific line numbers.
Code:
FILE_NAME="$( sed -n "$FLINE {p;q}" my_file.f )"