vendredi 4 novembre 2016

user input inside awk -- or -- variable usage in search pattern

I'm trying to take a user input in a pure [g]awk code. now the requirement is that I want the user to enter either today or current - number of days to generate a report. I can't find any routine inside the awk to read user's input. sometime back I had read a document on awk where it was done using either sprintf or printf, but I dont know how...any thoughts

OR

in awk, I'm using BEGIN block to setup a variable and then search based on that, but not finding it quite helpful to search the variable based search. something like below:

awk -F "|" ' BEGIN { PWR="Nov  3"; }
/Deployment started at PWR/ { print $1 + $NF }' /var/log/deployments

this offensively denies me any search for the pattern of "Deployment started at Nov 3".

Any idea..

Aucun commentaire:

Enregistrer un commentaire