Possible Duplicate:
Using awk with variables
The following command is wrong, the point is I want to use $curLineNumber
in awk, how can I do it? Any solution?
curLineNumber = 3
curTime=`ls -l | awk 'NR==$curLineNumber {print $NF}'`
Thanks
Possible Duplicate:
Using awk with variables
The following command is wrong, the point is I want to use $curLineNumber
in awk, how can I do it? Any solution?
curLineNumber = 3
curTime=`ls -l | awk 'NR==$curLineNumber {print $NF}'`
Thanks
The
-v
option is used to specify variables initialized on the command line. I chose the nameline
for theawk
variable.