file availability getline way
file availability getline way
(OP)
Hi,
I am using getline to check whether input file is available or not.
The following is working fine:
Input file name: file<ym>
read -p "Enter month : " ym
awk 'BEGIN{
but when i use the variable within awk its not working
awk 'BEGIN{
month=202303
Please help
Thank you
I am using getline to check whether input file is available or not.
The following is working fine:
Input file name: file<ym>
read -p "Enter month : " ym
awk 'BEGIN{
print getline < "file'$ym'" <0 ? "Not Available" : "Available"
}'but when i use the variable within awk its not working
awk 'BEGIN{
month=202303
print getline < "file"month <0 ? "Not Available" : "Available"
}'Please help
Thank you
RE: file availability getline way
Dumb thing as according to operator precedence should be fine, but in reality you have to add parentheses :
CODE
Feherke.
feherke.github.io
RE: file availability getline way
Does this parenthesis syntax apply only when getline is used?
RE: file availability getline way
Maybe my memories are failing, as I can not reproduce it right now, but I have a feeling that also met it with print when writing to file. But I would say on file/pipe input/output operations.
Feherke.
feherke.github.io