I have an awk script which is called something like this:
awk -f d.awk /var/log/app*.log
And this works fine. Log file path is constant and not changing (only the number of files changes in this location due to log rotation) so I want to remove it from command line and hard code inside the awk script. Is there a way to skip passing this argument from command line and hard code it within the awk script and still achieve the same result?
I read about getline but it is not working for me. awk script outline is something like this:
BEGIN{
#Initialization of few variable
}
match() {
#Main process logic
# Collect the output
output=output" " result_after_processing
}
END{
#Write the output to output file
print output >> some_output_file
}
awk -f, write a shell script which embeds the awk and uses/var/log/app*.logas arguments.awkto work on, you can't control that withawkgetline < "filename"to read file a file, but it won't expand wildcards, and I don't think there's a way to reassign awk's input to another file in general.ARGC/ARGVbased on your own scanning of a dir for files.