help with watch command with awk problem !
hi ,
if i use awk command without watch its fine
but if u use watch with awk it dont work
here is a an example :
watch --interval=5 "awk 'match($0,/http:\/\/[^/]+\//){_[substr($0,RSTART,RLENGTH)]=1}END{for (i in _) print i}' /home/p2"
im monitoring file /home/p2 ................ if i use :
"awk 'match($0,/http:\/\/[^/]+\//){_[substr($0,RSTART,RLENGTH)]=1}END{for (i in _) print i}' /home/p2"
it give me the output in the file , but i want to see the output of the file every 5 seconds by using watch command
i noted the problem in watch command , i saw the the command is changed :
here wt i mean
when i run the command
"awk 'match($0,/http:\/\/[^/]+\//){_[substr($0,RSTART,RLENGTH)]=1}END{for (i in _) print i}' /home/p2"
i see the screen
Every 5.0s: awk 'match(-su,/http:\/\/[^/]+\//){_[substr(-su,RSTART,RLENGTH)]=1}END{for (i in _) print i}' /home/p2
as u see above the $0 was changed with "-su" , i think this is the reason of my trouble
with to solve it
regards
|